7.5.20 GET DESCRIPTOR

Table of Contents Previous Next


7 Reference : 7.5 ECPGPlus Statements : 7.5.20 GET DESCRIPTOR

Use the GET DESCRIPTOR statement to retrieve information from a descriptor. The GET DESCRIPTOR statement comes in two forms. The first form returns the number of values (or columns) in the descriptor.
EXEC SQL GET DESCRIPTOR descriptor_name
:
host_variable = COUNT;
EXEC SQL [FOR array_size] GET DESCRIPTOR descriptor_name
VALUE
column_number {:host_variable = descriptor_item {,…}};
array_size is an integer value or a host variable that contains an integer value that specifies the number of rows to be processed. If you specify an array_size, the host_variable must be an array of that size; for example, if array_size is 10, :host_variable must be a 10-member array of host_variables. If you omit the FOR clause, the statement is executed once for each member of the array.
descriptor_name specifies the name of a descriptor (as a single-quoted string literal), or a host variable that contains the name of a descriptor.
Include the VALUE clause to specify the information retrieved from the descriptor.
column_number identifies the position of the variable within the descriptor.
host_variable specifies the name of the host variable that will receive the value of the item.
descriptor_item specifies the type of the retrieved descriptor item.
The following code fragment demonstrates using a GET DESCRIPTOR statement to obtain the number of columns entered in a user-provided string:
The example allocates an SQL descriptor (named parse_desc), before using a PREPARE statement to syntax check the string provided by the user (:stmt). A DESCRIBE statement moves the user-provided string into the descriptor, parse_desc. The call to EXEC SQL GET DESCRIPTOR interrogates the descriptor to discover the number of columns (:col_count) in the result set.

7 Reference : 7.5 ECPGPlus Statements : 7.5.20 GET DESCRIPTOR

Table of Contents Previous Next