DESCRIBE

DESCRIBE gathers information on the result set or dynamic variable specifications in a prepared statement and places the information in an SQL descriptor area.

describe.png

 

Usage

Embedded, Module.

Description

Information concerning the prepared statement identified by statement-name is placed in the named SQL descriptor area.

The DESCRIBE statement and the DESCRIBE OUTPUT statement are equivalent, and gather information on the items in the result set of the statement and places it in the SQL descriptor area.

The DESCRIBE INPUT statement describes the statement’s input and output variables.

The DESCRIBE OUTPUT statement describes the result set returned by the statement (a SELECT or a CALL to a result set procedure).

If descriptions of both the result set and the input variables are required for a prepared statement, the statement must be described separately with each form of DESCRIBE.

The descriptor-name is identified by a host variable or a literal.

WITHOUT NESTING is implicit.

See ALLOCATE DESCRIPTOR for a description of the SQL descriptor area.

See ALLOCATE CURSOR for a description of extended statements.

See also, GET DESCRIPTOR.

Restrictions

The DESCRIBE statement is only applicable to dynamically prepared SQL statements.

Examples

exec sql ALLOCATE DESCRIPTOR 'DescrIn';

exec sql ALLOCATE DESCRIPTOR 'DescrOut';

sqlstr = 'SELECT * FROM tab1 WHERE col1 = ? and col2 = ?';

exec sql PREPARE 'stmt X1' FROM :sqlstr;

exec sql DESCRIBE INPUT 'stmt X1' USING SQL DESCRIPTOR 'DescrIn';

exec sql DESCRIBE OUTPUT 'stmt X1' USING SQL DESCRIPTOR 'DescrOut';

 

sqlstr = 'CALL proc(?, ?, ?)';

exec sql PREPARE stmt2 FROM :sqlstr;

exec sql DESCRIBE INPUT stmt2 USING SQL DESCRIPTOR :SQLA1;

 

For more information, see the Mimer SQL Programmer's Manual, Describing Prepared Statements.

Standard Compliance

Standard

Compliance

Comments

SQL-2016

Features outside core

Feature B031, “Basic dynamic SQL”.