5. Embedded SQL for Ada : Dynamic Programming for Ada : SQLVAR Array Usage : SQL Type Codes
 
Share this page                  
SQL Type Codes
The following table describes the data type codes to use with Ada variables that are pointed at by the sqldata pointers:
Ada Type
SQL Type Codes (sqltype)
SQL Length (sqllen)
Short_Short_Integer
IISQ_INT_TYPE
1
Short_Integer
IISQ_INT_TYPE
2
Integer
IISQ_INT_TYPE
4
Float
IISQ_FLT_TYPE
4
Long_Float
IISQ_FLT_TYPE
8
String(1..LEN)
IISQ_CHA_TYPE
LEN
IISQLHDLR
IISQ_HDLR_TYPE
0
As described in (see page Ada Variables and Data Types), all other types are compatible with the above Ada data types. For example, you can retrieve an SQL date into an Ada string variable, while you can retrieve money into a long_float variable.
You can specify nullable data types (those variables that are associated with a null indicator) by assigning the negative of the type code to sqltype. If the type is negative then you must point at a null indicator by sqlind. The type of the null indicator must be a 2-byte integer, short_integer, or a derivative of that type.
Character data and the SQLDA have the same rules as character data in regular Embedded SQL statements. For details of character string processing in SQL, see Ada Variables and Data Types in this chapter.