DESCRIBE
The DESCRIBE statement allows you to obtain information about parameters and other features of a prepared object before you execute it.
Format 1
EXEC SQL [ AT Database ] DESCRIBE { BIND VARIABLES } FOR Prepared-Statement INTO { BNDDSC } { SELECT LIST } { SELDSC } END-EXEC |
Format2
EXEC SQL [ AT Database ] DESCRIBE { INPUT } Prepared-Statement INTO Sql-Descriptor { OUTPUT } END-EXEC |
Syntax rules
Format 1
Format 2
General rules
Format 1
1. DESCRIBE BIND VARIABLES puts descriptions of bind variables into a bind descriptor. It must follow the
PREPARE statement but precede the
OPEN.
2. DESCRIBE SELECT LIST puts descriptions of select-list items into a select descriptor. It must follow the
OPEN statement but precede the
FETCH statement.
Format 2
1. The input INPUT keyword lets you receive information about input parameters.
2. The input OUTPUT keyword lets you receive information about output parameters.
Examples
Prepare a command and get information about it in compatibility with IBM DB2
exec sql prepare cmd from "select c1 from tbl where c1 = ?" end-exec. exec sql describe input cmd into :sqlda end-exec. |