Obtains row format information about the result set of a prepared dynamic SQL statement and stores that information in a SQLDA structure.
exec sql describe [output] statement_name using descriptor sqlda_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 sqlda_name as a SQLDA structure.
The name of a SQLDA structure that will store the information returned by the describe output statement.
...
exec sql open curs2 using descriptor input_descriptor;
exec sql describe output statement using descriptor
output_descriptor;
output_descriptor->sqlda_column->sqlda_sqldata = character;
output_descriptor->sqlda_column->sqlda_datafmt.datatype = CS_CHAR_TYPE;
output_descriptor->sqlda_column->sqlda_datafmt.maxlength = 20;
output_descriptor->sqlda_column->sqlda_sqllen = 20;
output_descriptor->sqlda_column->sqlda_datafmt.format =
(CS_FMT_NULLTERM | CS_FMT_PADBLANK);
exec sql fetch curs2 into descriptor output_descriptor;
The information obtained is the data held in the SQLDA fields, such as 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.
describe input, execute, prepare