I'm trying to cast a number to DECIMAL(10,2). If I understand well, a number like "1234567890" should be a valid DECIMAL(10,2). But when I try to cast it, it returns an -413 error:
"OVERFLOW OR UNDERFLOW OCCURRED DURING NUMERIC DATA TYPE CONVERSION"
This is the SQL:
select CAST( 1234567890 AS DECIMAL(10,2)) from SYSIBM.SYSDUMMY1;
As I see it, the problem is that it is adding two zero decimal positions, so the total length is 12, which is not valid number for a (10,2).
In fact, if I try to CAST it to (12,2) it works (showing "1234567890.00" ).
I wonder if this is an error or if I'm doing something wrong. CASTING to (12,2) does not seem to be a valid option, because it will accept numbers like "1234567890.12" that should not be valid for a (10,2).
Thanks in advance.