NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
D-41
Examples—DESCRIBE INPUT
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 input parameters.
If you specify the NAMES INTO clause, DESCRIBE INPUT sets the VAR_PTR
field for each entry in the SQLDA to the address of the corresponding entry in the
names buffer.
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; the SQL identifier that is
the name itself follows. (The question mark that precedes a parameter name in an
SQL statement is not included in the name.) Unnamed parameters have a length
of 0.
If your program uses indicator parameters to handle null values, DESCRIBE INPUT
also returns the names of the indicator parameters to the names buffer. The
IND_PTR field of each SQLVAR entry contains the address of the corresponding
indicator parameter entry.
Examples—DESCRIBE INPUT
The following C statement returns descriptions of input variables in the prepared
statement identified by :stmt_name to an SQLDA structure pointed to by
:*input_sqlda_ptr.
EXEC SQL DESCRIBE INPUT :stmt_name INTO :*input_sqlda_ptr
NAMES INTO :*input_namesbuf_ptr;
The NAMES INTO clause directs DESCRIBE INTO to return the names of the
input variables to the buffer pointed to by :*input_namesbuf_ptr and to set the
var_ptr field of each entry in the SQLDA to the address of the corresponding name.
For examples of related statements and a detailed discussion of dynamic SQL
programming techniques, see the NonStop SQL/MP Programming Manual for C or
the NonStop SQL/MP Programming Manual for COBOL85.
DESCRIBE Statement
DESCRIBE is a dynamic SQL statement that returns descriptions of output variables
(usually SELECT columns) from a previously prepared statement.
DESCRIBE { stmt-name } INTO :sqlda
{ :stmt-variable }
[ NAMES INTO :names-buffer ]
[ COLLATIONS INTO :collations-buffer ]