base.SqlHandle.setParameter

Sets the value of a SQL parameter for this SQL handle.

Syntax

setParameter(
   index INTEGER,
   value fgl-type )
  1. index is the ordinal position of the ? SQL parameter (starts at 1).
  2. value is the variable containing the parameter value.

Usage

Call the setParameter() method to define the value of a SQL parameter specified with a ? place holder in the string passed to the prepare() method.

The SQL statement must have been prepared with a prepare() call.

The method will raise error -8131, if the index passed as parameter is lower than 1 or greater than the number of ? parameter placeholders in the prepared SQL statement.

It is possible to pass numeric and string constants directly to the method, but type conversion cannot be done without a program variable.

Example

DEFINE sh base.SqlHandle
DEFINE v_pk INT, v_crea DATETIME YEAR TO SECOND
...
CALL sh.setParameter(1,v_pk)
CALL sh.setParameter(2,v_crea)

For a complete example, see Example 2: SqlHandle with result set SQL.