Specify input parameter values
Since the DESCRIBE...INTO statement does not analyze the WHERE clause, your program must explicitly allocate an sqlda structure and the sqlvar_struct structures (see Allocate memory for the sqlda structure). To describe the input parameters you must determine the number of input parameters and their data types and store this information in the allocated sqlda structure. For general information about how to define input parameters dynamically, see Determine unknown input parameters.
When you execute a parameterized statement, you must include
the USING DESCRIPTOR clause to specify the sqlda structure
as the location of input parameter values, as follows:
- For input parameters in the WHERE clause of a SELECT statement, use the OPEN...USING DESCRIPTOR statement. This statement handles a sequential, scrolling, hold, or update cursor. If you are certain that the SELECT returns only one row, you can use the EXECUTE...INTO...USING SQL DESCRIPTOR statement instead of a cursor. For more information, see Handling a parameterized SELECT statement.
- For input parameters in the WHERE clause of a non-SELECT statement such as DELETE or UPDATE, use the EXECUTE...USING DESCRIPTOR statement. For more information, see Handling a parameterized UPDATE or DELETE statement.
- For input parameters in the VALUES clause of an INSERT statement, use the EXECUTE...USING SQL DESCRIPTOR statement. If the INSERT is associated with an insert cursor, use the PUT...USING DESCRIPTOR statement. For more information, see Handling an unknown column list.