Some operations can result in data overflow or truncation.
Overflow results in loss of data on the left. Truncation results
in loss of data on the right.
Overflow or truncation can occur in several instances as follows:
During arithmetic
operations, for example, when multiplication results in a number larger
than the maximum value allowable in its type. Arithmetic operations
are defined inChapter 8 “Expressions”
When using aggregate functions, for example, when
the sum of several numbers exceeds the maximum allowable size of
the type involved. Aggregate functions are defined in Chapter 8 “Expressions”
During type conversion, as when an INTEGER value
is converted to a SMALLINT value. Type conversion is discussed later
in this chapter.
Because large integers (less than -2147483648 (-231)
or larger than 2147483647 (231-1) up
to 15 digits long) are stored as decimals, large integer overflow
actually results in a DECIMAL OVERFLOW message.
Overflow always causes an error.
Truncation can cause a warning for the following types of
data:
Alphanumeric data—A
warning occurs if a string is truncated because it is too long for its
target location. No error is given if truncation occurs on input.
Numeric data—No error or warning occurs
when zeroes are dropped from the left or when any digit is dropped
from the fractional part of DECIMAL or FLOAT values. Otherwise,
truncation of numeric values causes an error.
LONG data—A warning occurs if LONG column
data is truncated because it is too long for its target input file.
The output file location is modified to fit the LONG column length,
so no truncation error occurs on LONG column output. If the file
system fills up, or the limit of shared memory is reached, a system
error occurs.
Refer to the ALLBASE/SQL Message Manual for
information on handling warnings and errors.