Datatypes
When a variable or constant is declared, it is associated with a datatype which affects the range of acceptable values and the operations that can be performed on it. PL/MX supports the following datatypes:
Datatype | Range | Operations |
BINARY_INTEGER | Integer values -2147483648 through 2147483647 | Arithmetic, Comparison |
Boolean | FALSE or TRUE | Logical, Comparison |
INT* | Integer values -2147483648 through 2147483647 and NULL | Arithmetic, Comparison |
INTEGER* | Integer values -2147483648 through 2147483647 and NULL | Arithmetic, Comparison |
LARGEINT* | Integer values -9223372036854775808 through 9223372036854775807 and NULL | Arithmetic, Comparison |
NATURAL | Integer values 0 through 2147483647 and NULL | Arithmetic, Comparison |
NATURALN | Integer values 0 through 2147483647 | Arithmetic, Comparison |
PLS_INTEGER | Integer values -2147483648 through 2147483647 and NULL | Arithmetic, Comparison |
POSITIVE | Integer values 1 through 2147483647 and NULL | Arithmetic, Comparison |
POSITIVEN | Integer values 1 through 2147483647 | Arithmetic, Comparison |
SIGNTYPE | Integer values -1 through 1 and NULL | Arithmetic, Comparison |
SMALLINT* | Integer values -32768 through 32767 and NULL | Arithmetic, Comparison |
* datatypes that are also built-in NonStop SQL/MX datatypes and therefore may be used as function parameters and return types.
All datatypes, with the exception of Boolean, are compatible with each other. One can combine them as operands in expressions or assign the value of one datatype to a variable of another datatype as long as the value is within the range of the target datatype. The compiler handles any necessary conversions.
The Boolean datatype can only be used with itself.