Determination of statement type in dynamically executed SQL programs
When an SQL statement
is prepared, you can determine information concerning the type of
statement by examining the SQLDA structure. This information is placed
in the SQLDA structure either at statement preparation time with the
INTO clause, or by issuing a DESCRIBE statement against a previously
prepared statement.
In either case, the database manager places a value in the SQLD field of the SQLDA structure, indicating the number of columns in the result table generated by the SQL statement. If the SQLD field contains a zero (0), the statement is not a SELECT statement. Since the statement is already prepared, it can immediately be executed using the EXECUTE statement.
If the statement contains parameter markers, the USING clause must be specified. The USING clause can specify either a list of host variables or an SQLDA structure.
If the SQLD field is greater than zero, the statement is a SELECT statement and must be processed as described in the following sections.