Subject Cast as Numeric without parenthesis
Author liviuslivius
Hi,
 
i know this kind of cast
SELECT CAST('1.23' AS NUMERIC(10, 2)) FROM RDB$DATABASE
 
but what are the rules for this (numeric without parenthesis)
[1]
SELECT CAST('1.23' AS NUMERIC) FROM RDB$DATABASE
result is "1"
 
[2]
SELECT CAST('12345678.23' as numeric) FROM RDB$DATABASE
result is "12345678"
 
[3]
SELECT CAST('123456789.23' as numeric) FROM RDB$DATABASE
SQL Message : -802
Arithmetic overflow or division by zero has occurred.
Engine Code    : 335544321
Engine Message :
arithmetic exception, numeric overflow, or string truncation
numeric value is out of range
 
[4]
SELECT CAST('123456789' as numeric) FROM RDB$DATABASE
result is "123456789"
 
[5]
SELECT CAST('12345678.23' as numeric) FROM RDB$DATABASE
result is "12345678"
 
[6]
SELECT CAST('1234567890' as numeric) FROM RDB$DATABASE
result is "1234567890"
 
[7]
SELECT CAST('12345678901' as numeric) FROM RDB$DATABASE
SQL Message : -802
Arithmetic overflow or division by zero has occurred.
Engine Code    : 335544321
Engine Message :
arithmetic exception, numeric overflow, or string truncation
numeric value is out of range
 
 
what are the rules and why
as you can see [3] raise error [4][6] not 
 
regards,
Karol Bieniaszewski