Contents Index SET CONNECTION statement [Interactive SQL] [ESQL] SET OPTION statement

ASA SQL Reference
  SQL Statements

SET DESCRIPTOR statement [ESQL]


Description 

Use this statement to describe the variables in a SQL descriptor area and to place data into the descriptor area.

Syntax 

SET DESCRIPTOR descriptor-name
COUNT = { integer | hostvar }
VALUE { integer | hostvar } assignment [, ...] }

assignment :
TYPE | SCALE | PRECISION | LENGTH | INDICATOR }
     = { integer | hostvar }
DATA = hostvar

Usage 

The SET DESCRIPTOR statement is used to describe the variables in a descriptor area, and to place data into the descriptor area.

The SET ... COUNT statement sets the number of described variables within the descriptor area. The value for count must not exceed the number of variables specified when the descriptor area was allocated.

The value { integer | hostvar } specifies the variable in the descriptor area upon which the assignment(s) will be performed.

Type checking is performed when doing SET ... DATA, to ensure that the variable in the descriptor area has the same type as the host variable. LONGVARCHAR and LONGBINARY are not supported by SET DESCRIPTOR ... DATA.

If an error occurs, the code is returned in the SQLCA.

Permissions 

None.

Side effects 

None.

See also 

ALLOCATE DESCRIPTOR statement [ESQL]

DEALLOCATE DESCRIPTOR statement [ESQL]

The SQL descriptor area (SQLDA)

Standards and compatibility 
Example 

The following example sets the type of the column with position col_num in sqlda.

void set_type( SQLDA *sqlda, int col_num, int new_type )
{
    EXEC SQL BEGIN DECLARE SECTION;
    int new_type1 = new_type;
    int col = col_num;
    EXEC SQL END DECLARE SECTION;
EXEC SQL SET DESCRIPTOR sqlda VALUE :col TYPE = :new_type1;
}

For a longer example, see ALLOCATE DESCRIPTOR statement [ESQL].


Contents Index SET CONNECTION statement [Interactive SQL] [ESQL] SET OPTION statement