Returned SQLCODE Values with EXECUTE
If a prepared statement fails to access any rows when it executes,
the database server returns the SQLCODE value of zero (0)
.
SQLNOTFOUND ( = 100)
: - INSERT INTO table SELECT ...; WHERE
- SELECT...;WHERE ...; INTO TEMP
- DELETE...; WHERE
- UPDATE ... WHERE
In an ANSI-compliant database, if you prepare and execute any of
the statements in the preceding list, and no rows are returned, the
returned SQLCODE value is SQLNOTFOUND ( = 100)
.
USING Clause
Element | Description | Restrictions | Syntax |
---|---|---|---|
descriptor | Quoted string that identifies a system-descriptor area | System-descriptor area must already be allocated. Use single ( ' ) quotation marks. | Quoted String |
descriptor_var | Host variable that identifies a system-descriptor area | System-descriptor area must already be allocated | Language specific |
indicator_var | Host variable that receives a return code if corresponding parameter_var is NULL value, or if truncation occurs | Cannot be DATETIME or INTERVAL data type | Language specific |
parameter_var | Host variable whose contents replace a question-mark ( ? ) placeholder in a prepared statement | Must be a character data type | Language specific |
sqlda_pointer | Pointer to an sqlda structure that defines data type and memory location of values to replace question-mark ( ? ) placeholder in a prepared object | Cannot begin with a dollar sign ( $ ) or a colon ( : ). An sqlda structure is required with dynamic SQL | DESCRIBE INPUT statement |
This closely resembles the syntax of the INTO Clause.
If you know the number of parameters to be supplied at runtime and their data types, you can define the parameters that are needed by the EXECUTE statement as host variables in your program.
If you do not know the number of parameters to be supplied at runtime or their data types, you can associate input values from a system-descriptor area or an sqlda structure. Both of these descriptor structures describe the data type and memory location of one or more values to replace question-mark ( ? ) placeholders.