base.SqlHandle.prepare
Prepares a SQL statement for the SQL handle.
Syntax
prepare(
sql STRING )
- sql is the SQL statement to be prepared.
Usage
Call the prepare()
method to prepare the SQL statement that will be executed
with either execute()
or open()
.
The SQL statement can contain ?
parameter place holders, to be filled with the
setParameter()
method before executing the statement.
As with standard Genero SQL instructions, SQL errors can be trapped
with WHENEVER ERROR
or TRY / CATCH
blocks and by testing
SQLCA.SQLCODE
.
Example
DEFINE sh base.SqlHandle
...
CALL sh.prepare("INSERT INTO mytable VALUES (?,?)")
For a complete example, see Example 2: SqlHandle with result set SQL.