The GET DESCRIPTOR statement

The GET DESCRIPTOR statement obtains values from the system-descriptor-area fields.

You can use the GET DESCRIPTOR statement to:
  • Get the COUNT field to determine how many values are described in a system-descriptor area.
    EXEC SQL get descriptor sysdesc :hostvar=COUNT;
  • Get the item-descriptor fields for each described column.
    EXEC SQL get descriptor sysdesc VALUE :item_num
       :hostvar=DESCRIP_FIELD;

    In this example, item_num is the number of the item descriptor that corresponds to the desired column, and DESCRIP_FIELD is one of the item-descriptor fields listed in Fields in each item descriptor of the system-descriptor area.

    These item-descriptor values are typically descriptions of columns in a SELECT, INSERT, or EXECUTE FUNCTION statement. GET DESCRIPTOR is also used after a FETCH...USING SQL DESCRIPTOR to copy a column value that is returned by the database server from the system-descriptor area into a host variable (Put column values into a system-descriptor area).

The data type of the host variable must be compatible with the type of the associated system-descriptor area field. When you interpret the TYPE field, make sure that you use the data type values that match your environment. For some data types, X/Open values differ from HCL OneDB™ values. For more information, see Determine the data type of a column.

For more information about how to get individual system-descriptor fields, see the entry for the GET DESCRIPTOR statement in the HCL OneDB Guide to SQL: Syntax.