Obtains row format information about the result set of a prepared dynamic SQL statement.
For a list of possible SQL descriptor datatype codes, see Table 10-5.
exec sql describe [output] statement_name using sql descriptor descriptor_name;
An optional keyword that has no effect on the describe output statement but provides conformance to the SQL standard.
The name (specified in a prepare statement) that represents the select statement to be executed.
Identifies descriptor_name as a SQL descriptor.
The name of a SQL descriptor that is to store the information returned by the describe output statement.
...
exec sql open curs2 using sql descriptor descr_out;
exec sql describe output prep_stmt4
using sql descriptor descr_out;
while (sqlca.sqlcode != 100 && sqlca.sqlcode >= 0)
{
exec sql fetch curs2 into sql descriptor
descr_out;
print_descriptor();
}
exec sql close curs2;
exec sql deallocate descriptor descr_out;
exec sql deallocate prepare prep_stmt4;
printf("dynamic sql method 4 completed\n\n");
}
...
The information obtained is the type, name, length (or precision and scale, if a number), nullable status, and number of items in the result set.
The information is about the result columns from the select column list.
Execute this statement before the prepared statement executes. If you perform a describe output statement after you execute and before you perform a get descriptor, the results will be discarded.
allocate descriptor, describe input, execute, get descriptor, prepare