Contents Index GET DATA statement [ESQL] GET OPTION statement [ESQL]

ASA SQL Reference
  SQL Statements

GET DESCRIPTOR statement [ESQL]


Description 

Use this statement to retrieve information about a variable within a descriptor area, or retrieves its value.

Syntax 

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

assignment :
 hostvar =  TYPE | LENGTH | PRECISION | SCALE | DATA | INDICATOR | NAME | NULLABLE | RETURNED_LENGTH

Usage 

The GET DESCRIPTOR statement is used to retrieve information about a variable within a descriptor area, or to retrieve its value.

The value { integer | hostvar } specifies the variable in the descriptor area about which the information will be retrieved. Type checking is performed when doing GET ... DATA to ensure that the host variable and the descriptor variable have the same data type. LONGVARCHAR and LONGBINARY are not supported by GET DESCRIPTOR ... DATA.

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

Permissions 

None.

Side effects 

None.

See also 

ALLOCATE DESCRIPTOR statement [ESQL]

DEALLOCATE DESCRIPTOR statement [ESQL]

SET DESCRIPTOR statement [ESQL]

The SQL descriptor area (SQLDA)

Standards and compatibility 
Example 

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

int get_type( SQLDA *sqlda, int col_num )
{
    EXEC SQL BEGIN DECLARE SECTION;
    int ret_type;
    int col = col_num;
    EXEC SQL END DECLARE SECTION;
EXEC SQL GET DESCRIPTOR sqlda VALUE :col :ret_type = TYPE;
    return( ret_type );
}

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


Contents Index GET DATA statement [ESQL] GET OPTION statement [ESQL]