SQL Programming Manual for TAL

Dynamic NonStop SQL Operations
HP NonStop SQL Programming Manual for TAL527887-001
7-21
Dynamically Allocating Memory
Literal Declarations
Your program will need to check DATA^TYPE to make sure that the type of the value to
be placed in the buffer pointed to by VAR^PTR matches the type expected by SQL.
Table 7-1
shows the literal declarations that represent various data types that you can
use in your program.
Other literal declarations have been defined to represent PRECISION values for
numeric and date-time values and to be used with the PRECISION field of the SQLDA.
For a complete list of data type and PRECISION literal declarations, see the INCLUDE
SQLDA statement in Section 6
. To include the declarations for these literals, use the
SOURCE directive to include the TALDECS file:
?SOURCE $system.system.TALDECS
Figure 7-3 shows sample code for allocating memory for input parameter values. You
can use the same code later to allocate memory for output variables.
Table 7-1. Literal Declarations for Data Types
Literal Declaration Data Type
_SQLDT_ASCII_F Fixed-length character string
_SQLDT_ASCII_V Variable-length character string
_SQLDT_16BIT_S 16-bit signed integer
_SQLDT_16BIT_U 16-bit unsigned integer
_SQLDT_32BIT_S 32-bit signed integer
_SQLDT_32BIT_U 32-bit unsigned integer
_SQLDT_REAL 32-bit floating point
_SQLDT_DOUBLE 64-bit floating point
_SQLDT_64BIT_S 64-bit signed integer
_SQLDT_DEC_U Unsigned ASCII numeric (DECIMAL) number
_SQLDT_DEC_LSS DECIMAL number, leading sign separate
_SQLDT_DEC_LSE DECIMAL number, leading sign embedded
_SQLDT_DEC_TSS DECIMAL number, trailing sign separate
_SQLDT_DEC_TSE DECIMAL number, trailing sign embedded
_SQLDT_DATETIME DATETIME item