SQL Programming Manual for TAL

Host Variables and Parameters
HP NonStop SQL Programming Manual for TAL527887-001
2-5
Overriding Default Data Types
Overriding Default Data Types
Each TAL data type has a default SQL data type used by the SQL compiler. In most
cases, you can define your host variables to match the SQL data types shown in
Table 2-1 on page 2-3. Sometimes, however, you might want to use another data type.
Some TAL data types allow you to override the default type by specifying an override
SQL data type as an attribute of the host variable. The syntax to override a data type
is:
TAL-type
is the TAL data type plus any indirection symbol. For example:
INT
INT(32)
INT .
INT .EXT
hostvar-name
is the name of the host variable.
array-bounds
is the bounds of an array. For example, in the declaration:
INT numbers[0:19];
[0:19] is the bounds.
override-SQL-type
is the SQL data type that will override the default type that NonStop SQL normally
uses for TAL-type. Specify override-SQL-type after the host variable and any array
bounds but before initialization or address equivalence takes place.
Also, when you use a host variable in an SQL statement, you can override character
data types by using the:
TYPE AS clause to specify that the character string should be interpreted as a
date-time value. The TYPE AS clause is described under Using Date-Time and
INTERVAL Data Types as Host Variables on page 2-15.
SETSCALE function to indicate that an integer host variable is to be interpreted as
having scale. SETSCALE is described under Using Scaled Numeric Data Items as
Host Variables on page 2-12.
Table 2-2 shows how NonStop SQL interprets TAL data types, and the override data
types you can specify.
TAL-type hostvar-name [array-bounds] [/ override-SQL-type/]