prepare

Creates a java.sql.PreparedStatement using the value of the String, accessible in sqlf by the Identifier given to it.

Syntax

PREPARE Identifier AS String

Description

Creates a java.sql.PreparedStatement using the value of the String, accessible in sqlf by the Identifier given to it. If a prepared statement with that name already exists in sqlf, an error is returned and the previous prepared statement remains. Use the Remove command to remove the previous statement first. If errors occur, no prepared statement is created.

Any SQL statements allowed in the underlying connection's prepared statement can be prepared with this command.

Example

sqlf(PEERCLIENT)> prepare listAirlines as 'SELECT * FROM airlines';
sqlf(PEERCLIENT)> execute listAirlines;
A&|AIRLINE_FULL            |BASIC_RATE            |DISTANCE_DISCOUNT     |BUSINESS_LEVEL_FACTOR |FIRSTCLASS_LEVEL_FACT&|ECONOMY_SE&|BUSINESS_S&|FIRSTCLASS&
-----------------------------------------------------------------------------------------------------------------------------------------------------------
NA|New Airline             |0.2                   |0.07                  |0.6                   |1.7                   |20         |10         |5
US|Union Standard Airlines |0.19                  |0.05                  |0.4                   |1.6                   |20         |10         |5
AA|Amazonian Airways       |0.18                  |0.03                  |0.5                   |1.5                   |20         |10         |5

3 rows selected