SET DESCRIPTOR

Set values in an SQL descriptor area.

set_descriptor.png

 

where set-item-information is:

set_item_information.png

 

Usage

Embedded, Module.

Description

Fields values are assigned in the specified SQL descriptor area. The SET DESCRIPTOR statement can be used in two forms. The COUNT form sets the number of active item descriptor areas for the specified SQL descriptor. The VALUE form assigns SQL descriptor field values for the item descriptor area specified by item-number.

The descriptor-name is identified by a host variable or a literal.

See GET DESCRIPTOR for a description of the descriptor fields.

Notes

The data type of the host variables must be compatible with the data type of the associated field name.

If an item descriptor area is specified for any field other than DATA, the DATA field becomes undefined.

When the TYPE field is set, some of the other fields are implicitly set according to the table below:

Type

Implicitly set fields

BINARY

LENGTH set to 1

BINARY VARYING

LENGTH set to 1

CHARACTER

LENGTH set to 1

VARCHAR

LENGTH set to 1

NATIONAL CHARACTER

LENGTH set to 1

NCHAR VARYING

LENGTH set to 1

BLOB

LENGTH set to 1

CLOB

LENGTH set to 1

NCLOB

LENGTH set to 1

DATETIME

PRECISION set to 0

DECIMAL

PRECISION set to 15, SCALE set to 0

DOUBLE PRECISION

PRECISION set to 16

FLOAT

PRECISION set to 16

INTEGER

PRECISION set to 10

INTERVAL

DATETIME_INTERVAL_PRECISION set to 2

REAL

PRECISION set to 7

SMALLINT

PRECISION set to 5

Example

exec sql SET DESCRIPTOR 'descrIn' VALUE :n TYPE = :type,

                                           LENGTH = :length;

Standard Compliance

Standard

Compliance

Comments

SQL-2016

Features outside core

Feature B031, “Basic dynamic SQL.”

Feature B032, “Extended dynamic SQL” support for dynamic descriptor names.