Updated on 2024-05-07 GMT+08:00

SET DESCRIPTOR

Description

Populates an SQL descriptor area, which is usually used to bind parameters in a prepared query execution. This command can be in either of the following formats:
  • Applies to the descriptor "header", which is independent of specific data.
  • Assigns a value to specific data identified by a number.

Syntax

SET DESCRIPTOR descriptor_name descriptor_header_item = value [, ... ]
SET DESCRIPTOR descriptor_name VALUE number descriptor_item = value [, ...]

Parameters

  • descriptor_name

    SQL descriptor name.

  • descriptor_header_item

    Identifies the header information item to be set. Currently, only COUNT that can be used to set the number of descriptor items is supported.

  • number

    Number of descriptor items to be set. The count starts at 1.

  • descriptor_item

    Identifies which descriptor item is to be set. Currently, only DATA, TYPE, and LENGTH are supported.

  • value

    Value to be stored in the descriptor item. The value can be an SQL constant or a host variable.

Examples

EXEC SQL SET DESCRIPTOR indesc COUNT = 1; 
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2; 
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1; 
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val1, DATA = 'some string'; 
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2null, DATA = :val2;