SQL Programming Manual for TAL
Host Variables and Parameters
HP NonStop SQL Programming Manual for TAL—527887-001
2-3
Using Corresponding SQL and TAL Data Types
Table 2-1. Corresponding NonStop SQL and TAL Data Types
SQL Data Type TAL Data Type
Character Data
CHAR(n), PIC X(n)
VARCHAR(n)
STRING [0: n - 1]
STRUCT identifier;
BEGIN
INT length;
STRING value[0: n-1];
END;
Numeric Data
NUMERIC (1 to 4, s) SIGNED INT
NUMERIC (1 to 4, s) UNSIGNED INT / SMALLINT UNSIGNED / 1
NUMERIC (5 to 9, s) SIGNED INT(32)
NUMERIC (5 to 9, s) UNSIGNED INT(32) / INTEGER UNSIGNED/ 1
NUMERIC (10 to 18, s) SIGNED FIXED(s)
PIC [s]9(n- s)V9(s) [COMP] Same as TAL data types for NUMERIC
DECIMAL(n, s) STRING[0: n-1] / DECIMAL / 1
DECIMAL(n, s) UNSIGNED STRING[0: n-1] /DECIMAL UNSIGNED/ 1
PIC[s] 9(n- s)V9(s)
SMALLINT INT
SMALLINT UNSIGNED INT / SMALLINT UNSIGNED / 1
INTEGER INT(32)
INTEGER UNSIGNED INT(32) / INTEGER UNSIGNED / 1
LARGEINT SIGNED FIXED(0)
FLOAT (1 to 22), REAL REAL
Date-Time Data
DATETIME, TIMESTAMP, DATE, TIME STRING [0: n-1]
INTERVAL Data
INTERVAL STRING[0: n]
2
n is a positive integer that represents the length. For DECIMAL, n must range from 1 through 18.
s is a positive integer that represents the scale of the number.
1 SQL data types between slashes specify override data type mapping (on page 2-4
).
2 A host variable for an INTERVAL value has an extra byte to hold a sign.