SQL/MX 2.x Reference Manual (G06.24+, H06.03+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual523725-004
6-34
Numeric Data Types
SMALLINT [SIGNED|UNSIGNED]
specifies an exact numeric column—a two-byte binary integer, SIGNED or
UNSIGNED. The column stores integers in the range unsigned 0 to 65535 or signed
-32768 to +32767.
The default is SIGNED.
INT[EGER] [SIGNED|UNSIGNED]
specifies an exact numeric column—a four-byte binary integer, SIGNED or
UNSIGNED. The column stores integers in the range unsigned 0 to 4294967295 or
signed -2147483648 to +2147483647.
The default is SIGNED.
LARGEINT
specifies an exact numeric column—an eight-byte signed binary integer. The
column stores integers in the range -2**63 to 2**63 -1 (approximately 9.223 times
10 to the eighteenth power).
DEC[IMAL] [(precision [,scale])] [SIGNED|UNSIGNED]
specifies an exact numeric column—a decimal number, SIGNED or UNSIGNED,
stored as ASCII characters. precision specifies the total number of digits and
cannot exceed 18. If precision is 10 or more, the value must be SIGNED. The
sign is stored as the first bit of the leftmost byte. scale specifies the number of
digits to the right of the decimal point.
The default is DECIMAL (9,0) SIGNED.
PIC[TURE] [S]{ 9(integer) [V[9(scale)]] | V9(scale) }
[DISPLAY [SIGN IS LEADING] | COMP]
specifies an exact numeric column. If you specify COMP, the column is binary and
equivalent to the data type NUMERIC. If you omit COMP, DISPLAY [SIGN IS
LEADING] is the default, and the data type is equivalent to the data type DECIMAL.
The S specifies a signed column. The sign is stored as the first bit of the leftmost
byte (digit). If you omit S, the column is unsigned. A column with ten or more digits
must be signed.
The 9(integer) specifies the number of digits in the integral part of the value.
The V designates a decimal position. The 9(scale) designates the number of
positions to the right of the decimal point. If you omit V9 (scale), the scale is 0. If
you specify only V9, the scale is 1.
Instead of integer or scale, you can specify multiple 9s, with each 9
representing one digit. For example, PIC 9V999 has a scale of 3. The values of
integer and scale determine the length of the column. The sum of these values
cannot exceed 18.