DESCRIBE
Go Up to Statement and Function Reference (Language Reference Guide)
Provides information about columns that are retrieved by a dynamic SQL (DSQL) statement, or information about the dynamic parameters that statement passes. Available in gpre
.
DESCRIBE [OUTPUT | INPUT] statement
{INTO | USING} SQL DESCRIPTOR xsqlda;
Argument | Description |
---|---|
|
[Default] Indicates that column information should be returned in the |
|
Indicates that dynamic parameter information should be stored in the |
<statement> |
|
|
Specifies the |
Description: DESCRIBE
has two uses:
- As a describe output statement,
DESCRIBE
stores into anXSQLDA
a description of the columns that make up the select list of a previously-prepared statement. If thePREPARE
statement included anINTO
clause, it is unnecessary to useDESCRIBE
as an output statement. - As a describe input statement,
DESCRIBE
stores into anXSQLDA
a description of the dynamic parameters that are in a previously-prepared statement.
DESCRIBE
is one of a group of statements that process DSQL statements.
Statement | Purpose |
---|---|
|
Readies a |
|
Fills in the |
|
Executes a previously-prepared statement. |
|
Prepares a |
Separate DESCRIBE
statements must be issued for input and output operations. The INPUT
keyword must be used to store dynamic parameter information.
When using
DESCRIBE
for output, if the value returned in the sqld field in the XSQLDA
is larger than the sqln field, you must:- Allocate more storage space for
XSQLVAR
structures. - Reissue the
DESCRIBE
statement.
The same XSQLDA structure can be used for input and output if desired.
Example: The following embedded SQL statement retrieves information about the output of a SELECT
statement:
EXEC SQL
DESCRIBE Q INTO xsqlda
The next embedded SQL statement stores information about the dynamic parameters passed with a statement to be executed:
EXEC SQL
DESCRIBE INPUT Q2 USING SQL DESCRIPTOR xsqlda;