SQL/MX 3.2 Installation and Upgrade Guide (H06.25+, J06.14+)

Table Of Contents
E Conversions
Conversions from numeric to char or varchar
SQL/MX Release 3.x reports 8402 errors during conversions from numeric to char or varchar
types with truncation. In SQL/MX Release 2.x, such conversions truncate the data without any
errors.
The following examples illustrate overflow errors generated in SQL/MX Release 3.x:
Example 1
>>create table tnumeric (a numeric (18,6));
--- SQL operation complete.
>>
>>insert into tnumeric values (123456789012.345678);
--- 1 row(s) inserted.
>>
>>select cast(a * 10 as char(18)) from tnumeric;
*** ERROR[8402] A string overflow occurred during the
evaluation of a character expression. Conversion of Source
Type:DECIMAL SIGNED(REC_DECIMAL_LSE) Source
Value:0x2B0001020304050607080900010203040506070800 to Target
Type:CHAR(REC_BYTE_F_ASCII).
--- 0 row(s) selected.
>>
Example 2
>>create table tnumeric (a numeric (18,6));
--- SQL operation complete.
>>
>>insert into tnumeric values (3.0),(123456789012.345678);
--- 2 row(s) inserted.
>>
>>select cast(a * 10 as char(18)) from tnumeric;
(EXPR)
------------------
30.000000
*** ERROR[8402] A string overflow occurred during the
evaluation of a character expression. Conversion of Source
Type:DECIMAL SIGNED(REC_DECIMAL_LSE) Source
Value:0x2B0001020304050607080900010203040506070800 to Target
Type:CHAR(REC_BYTE_F_ASCII).
--- 1 row(s) selected.
>>
>>select cast (max(a) as varchar(8)) from tnumeric;
*** ERROR[8402] A string overflow occurred during the
evaluation of a character expression. Conversion of Source
Type:LARGEINT(REC_BIN64_SIGNED) Source Value:123456789012345678 to Target
Type:VARCHAR(REC_BYTE_V_ASCII).
--- 0 row(s) selected.
>>
>>select cast(a * a as char(18)) from tnumeric;
(EXPR)
------------------
9.000000000000
*** ERROR[8402] A string overflow occurred during the
evaluation of a character expression. Conversion of Source
Type:DECIMAL SIGNED(REC_DECIMAL_LSE) Source
Value:0x2B000105020401050708070503020308080306050207090608020
909070605020709060804 to Target Type:CHAR(REC_BYTE_F_ASCII).
Conversions from numeric to char or varchar 67