SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
D-45
Example—DESCRIBE
Example 3:
STATEMENT
 SELECT C1 FROM =TABLE_NAME_1 WHERE C1 > 100;
 NAMES-BUFFER (OUTPUT)
 {15}TABLE_NAME_1.C1
Example 4:
STATEMENT
 SELECT C1 FROM =TABLE_NAME_1 T1 WHERE T1.C1 > 100;
 NAMES-BUFFER (OUTPUT)
 {05}T1.C1
For information about the contents and use of a names buffer, see the SQL/MP 
programming manual for your host language.
COLLATIONS INTO :collations-buffer
specifies the name of a collations buffer declared in an INCLUDE SQLDA 
statement or elsewhere in your program into which DESCRIBE returns collations 
associated with the SELECT columns.
If you specify the COLLATIONS INTO clause, DESCRIBE sets the CPRL_PTR 
item for each entry in the SQLDA to the address of the corresponding entry in the 
collations buffer.
Each entry in the collation buffer is in VARCHAR format: the entry begins with a 
2-byte numeric prefix that contains the length of the collation; the collation follows.
To compare collations associated with different objects, use the Guardian 
procedures described in the SQL/MP programming manual for your host language.
Example—DESCRIBE
This COBOL statement returns descriptions of output variables in the prepared 
statement identified by S1 to the SQLDA identified by :OUT-SQLDA:
EXEC SQL DESCRIBE S1 INTO :OUT-SQLDA
 NAMES INTO :OUT-NAMESBUF
 COLLATIONS INTO :OUT-COLLBUF END-EXEC.
The NAMES INTO and COLLATIONS INTO clauses direct DESCRIBE to return 
the names of the output variables and any collations associated with the output 
variables to buffers reserved for them. DESCRIBE sets the VAR-PTR and 
CPRL-PTR fields of each entry in the SQLDA to the addresses of the 
corresponding name and collation.
For examples of related statements and a detailed discussion of dynamic SQL 
programming techniques, see the SQL/MP Programming Manual for C or the 
SQL/MP Programming Manual for COBOL.










