Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

GET DESCRIPTOR statement [ESQL]

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

Privileges

None.

Side effects

None.

Standards
  • ANSI/ISO SQL Standard

    GET DESCRIPTOR is part of optional ANSI/ISO SQL Language Feature B031, "Basic dynamic SQL".

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 );
}