You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=====================
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
SQL>
=============================================
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
SQL>
But:
SQL> select round( cast(170141183460469231731687303715884105727 as int128),0) from rdb$database;
=====================
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
SQL>
summary: ROUND() of INT128 number requires is to be explicitly cased to INT128 => ROUND() does not allow second argument >=1 when its first argument is more than MAX_BIGINT / 10
Submitted by: @pavel-zotov
Consider number: 922337203685477580 = floor( max_bigint / 10 )
This:
SQL> select round( 922337203685477580 ,1) from rdb$database;
-- works OK:
INPUT message field count: 0
OUTPUT message field count: 1
01: sqltype: 580 INT64 scale: 0 subtype: 0 len: 8
: name: ROUND alias: ROUND
: table: owner:
=====================
922337203685477580
The same number + 1 will fail:
SQL> select round( 922337203685477581,1) from rdb$database;
INPUT message field count: 0
OUTPUT message field count: 1
01: sqltype: 580 INT64 scale: 0 subtype: 0 len: 8
: name: ROUND alias: ROUND
: table: owner:
=====================
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
SQL>
Commits: fd9600f
The text was updated successfully, but these errors were encountered: