NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
D-42
DESCRIBE Statement
stmt-name
is the SQL identifier of the prepared SQL statement.
:stmt-variable
is the name of a host variable that stores the SQL identifier of the prepared SQL
statement.
INTO :sqlda
specifies the host variable name of an SQLDA declared in an INCLUDE SQLDA
statement into which DESCRIBE returns:
If the SQLDA is not large enough to describe all the SELECT columns, DESCRIBE
returns only the descriptions of the first n columns in the SELECT, where n is the
number of entries in the SQLDA. (In either case, DESCRIBE does not modify the
NUM_ENTRIES field in the SQLDA, which indicates the number of entries the
SQLDA can hold.)
For more information about the contents and use of an SQLDA, see the NonStop
SQL/MP programming manual for your host language.
NAMES INTO :names-buffer
specifies the host variable name of a names buffer declared in an INCLUDE
SQLDA statement or elsewhere in your program into which DESCRIBE returns the
names of the SELECT columns (or the SYSKEY column) described in the SQLDA.
If you specify the NAMES INTO clause, DESCRIBE sets the VAR_PTR item for
each entry in the SQLDA to the address of the corresponding entry in the names
buffer. (If the buffer is not large enough to contain all the names, DESCRIBE sets
the VAR_PTR field for any name that does not fit to a value less than 0; if the buffer
is larger than necessary, DESCRIBE ignores the extra bytes.)
Each entry in the names buffer is in VARCHAR format: the entry begins with a 2-
byte NUMERIC prefix that contains the length of the name and the name follows, in
the form:
tablename.columnname
If the name has an odd number of characters, it is followed by a blank to make it an
even length. If a SELECT column is a constant or expression, the name entry has a
length of 0.
A SYSKEY column name for a table is table-name.SYSKEY. A SYSKEY
column name for a view is view-name.derived-column-name.
For more information about the contents and use of a names buffer, see the NonStop
SQL/MP programming manual for your host language.
For a SELECT The number of SELECT columns and a description of each column
For an INSERT The data type, length, and scale for the system-defined primary key
(SYSKEY) of the last record inserted