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,
DESCRIBEstores into anXSQLDAa description of the columns that make up the select list of a previously-prepared statement. If thePREPAREstatement included anINTOclause, it is unnecessary to useDESCRIBEas an output statement. - As a describe input statement,
DESCRIBEstores into anXSQLDAa 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.
- Important: When using
DESCRIBEfor output, if the value returned in the sqld field in theXSQLDAis larger than the sqln field, you must:
- Allocate more storage space for
XSQLVARstructures. - Reissue the
DESCRIBEstatement.
- Note: 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;