DESCRIBE

From InterBase

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

OUTPUT

[Default] Indicates that column information should be returned in the XSQLDA.

INPUT

Indicates that dynamic parameter information should be stored in the XSQLDA.

<statement>

  • A previously defined alias for the statement to DESCRIBE.
  • Use PREPARE to define aliases.

{INTO | USING} SQL DESCRIPTOR <xsqlda>

Specifies the XSQLDA to use for the DESCRIBE statement.

Description: DESCRIBE has two uses:

  • As a describe output statement, DESCRIBE stores into an XSQLDA a description of the columns that make up the select list of a previously-prepared statement. If the PREPARE statement included an INTO clause, it is unnecessary to use DESCRIBE as an output statement.
  • As a describe input statement, DESCRIBE stores into an XSQLDA 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

PREPARE

Readies a DSQL statement for execution.

DESCRIBE

Fills in the XSQLDA with information about the statement.

EXECUTE

Executes a previously-prepared statement.

EXECUTE IMMEDIATE

Prepares a DSQL statement, executes it once, and discards it.

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 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.
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;

See Also

Advance To: