Alex Peshkoff via Firebird-devel <firebird-devel@lists.sourceforge.net>
wrote Tue, 17 Sep 2019 13:42:17 +0300:
SQL> select cast(12345678901234567890 as numeric(25, 0)) as n from
rdb$database;
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
That's very strange - that works for me.
It seems isql does not yet have native support for int128.
Please create a table with numeric(25, 0) and try to work (insert,
select) with it.
SQL> create database 'inet://localhost:3054/test' user sysdba password
'masterkey' default character set utf8;
SQL> show database;
Database: inet://localhost:3054/test
Owner: SYSDBA
PAGE_SIZE 8192
Number of DB pages allocated = 212
Number of DB pages used = 192
Number of DB pages free = 20
Sweep interval = 20000
Forced Writes are ON
Transaction - oldest = 1
Transaction - oldest active = 2
Transaction - oldest snapshot = 2
Transaction - Next = 6
ODS = 13.0
Database not encrypted
Default Character set: UTF8
SQL> show version;
ISQL Version: WI-T4.0.0.1604 Firebird 4.0 Beta 1
Server version:
Firebird/Windows/AMD/Intel/x64 (access method), version "WI-T4.0.0.1604
Firebird 4.0 Beta 1"
Firebird/Windows/AMD/Intel/x64 (remote server), version "WI-T4.0.0.1604
Firebird 4.0 Beta 1/tcp (station9)/P16:C"
Firebird/Windows/AMD/Intel/x64 (remote interface), version "WI-T4.0.0.1604
Firebird 4.0 Beta 1/tcp (station9)/P16:C"
on disk structure version 13.0
SQL> recreate table t (
CON> id bigint generated by default as identity not null,
CON> n numeric(20, 0),
CON> constraint pk_t primary key(id)
CON> );
SQL> insert into t(n) values(1);
SQL> commit;
SQL> select n from t;
N
=============================================
1
SQL> insert into t(n) values(12345678901234567890); <-- That's very
strange n is 20 symbols
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
SQL> show table t;
ID BIGINT Not Null Identity (by default)
N NUMERIC(20, 0) Nullable
CONSTRAINT PK_T:
Primary key (ID)
SQL> select
CON> rf.rdb$field_name as field_name,
CON> f.rdb$field_type as field_type,
CON> f.rdb$field_scale as field_scale
CON> from rdb$relation_fields rf
CON> join rdb$fields f on f.rdb$field_name = rf.rdb$field_source
CON> where rf.rdb$relation_name = 'T';
FIELD_NAME FIELD_TYPE
FIELD_SCALE
=============================================================== ==========
===========
ID
16 0
N
26 0
FIELD_TYPE = 26 - this is bigint
SQL> alter table t add n2 numeric(36, 0);
SQL> insert into t(n, n2) values(1, 12345678901234567890);
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
SQL> show table t;
ID BIGINT Not Null Identity (by default)
N NUMERIC(20, 0) Nullable
N2 NUMERIC(36, 0) Nullable
CONSTRAINT PK_T:
Primary key (ID)
SQL> alter table t add n3 decimal(36, 0);
SQL> insert into t(n, n3) values(1, 12345678901234567890);
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range
I don’t know, maybe because the windows platform?
--
Simonov Denis
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel