DESCRIBE statement

Use the DESCRIBE statement to obtain information about output parameters and other features of a prepared object before you execute it.

Use this statement with . (See also DESCRIBE INPUT statement.)


1 statement_id_var
1 statement_id
3.2.1 descriptor_var
3.2.1 'descriptor'
3.1  INTO
3.2.1  SQL DESCRIPTOR descriptor_var 'descriptor'
3.2.1 sqlda_pointer
Element Description Restrictions Syntax
descriptor Name of a system-descriptor area System-descriptor area must already be allocated Quoted String
descriptor_var Host variable specifying a system-descriptor area Must contain the name of an allocated system-descriptor area Language-specific rules for names
sqlda_pointer Pointer to an sqlda structure Cannot begin with dollar ( $ ) sign or colon ( : ). An sqlda structure is required if dynamic SQL is used. See the sqlda structure in the HCL OneDB™ ESQL/C Programmer's Manual
statement_id Statement identifier for a prepared SQL statement Must be defined in a previous PREPARE statement PREPARE statement; Identifier
statement _id_var Host variable that contains the value of statement_id Must be declared in a previous PREPARE statement Language-specific rules for names


DESCRIBE can provide information at runtime about a prepared statement:
  • The type of SQL statement that was prepared
  • Whether an UPDATE or DELETE statement contains a WHERE clause
  • For an EXECUTE, EXECUTE FUNCTION, EXECUTE PROCEDURE, INSERT, SELECT, or UPDATE statement, the DESCRIBE statement also returns the number, data types, and size of the output parameter values.
  • For a SELECT statement, DESCRIBE also returns the name of the column or expression that the query returns.

With this information, you can write code to allocate memory to hold retrieved values and display or process them after they are fetched.