SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
D-44
DESCRIBE Statement
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 information about the contents and use of an SQLDA, see the 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.
The table name could be the actual table name itself, a user specified
correlation name, or a DEFINE name for the table (without the leading = sign).
The precedence is: correlation name first, define name second, and the actual
table name the last. For example:
Example 1:
STATEMENT
SELECT C1 FROM TABLE1 WHERE C1 > 100;
NAMES-BUFFER (OUTPUT)
{09}TABLE1.C1
Example 2:
STATEMENT
SELECT C1 FROM TABLE1 T1 WHERE T1.C1 > 100;
NAMES-BUFFER (OUTPUT)
{05}T1.C1