Only the negative range goes to 2147483648 and you used positive value which is 
ranged till 2147483647,
 
so this should work
 
SELECT CAST('-2147483648' as numeric) FROM RDB$DATABASE 
 SELECT CAST('-2147483648' as numeric(9,0)) FROM RDB$DATABASE 

 
To: [email protected]
From: [email protected]
Date: Thu, 26 Mar 2015 10:05:17 +0100
Subject: RE: [firebird-support] Cast as Numeric without parenthesis














 

 



  


    
      
      
      I would expect numbers in the range -2147483648 to +2147483647 to be 
accepted (the size of an integer), and then there’s a separate field for 
storing whether things are shifted to the left or right. I’ve no experience or 
theoretical knowledge confirming this, but your examples would fit such a 
description. Hence, I would guess NUMERIC to default to NUMERIC(9, 0).





I've confirmed that





SELECT CAST('2147483647' as numeric) FROM RDB$DATABASE


SELECT CAST('2147483647' as numeric(9,0) FROM RDB$DATABASE





both are accepted, whereas





SELECT CAST('2147483648' as numeric) FROM RDB$DATABASE


SELECT CAST('2147483648' as numeric(9,0) FROM RDB$DATABASE





are rejected.





HTH,


Set





    
     

    
    






                                          

Reply via email to