GET DESCRIPTOR statement [ESQL]

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
descriptor-name : identifier
Remarks

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 is retrieved. Type checking is performed when doing GET ... DATA to ensure that the host variable and the descriptor variable have the same data type. LONG VARCHAR and LONG BINARY are not supported by GET DESCRIPTOR ... DATA.

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

Permissions

None.

Side effects

None.

See also
Standards and compatibility
  • SQL/2003   Core feature.

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].