On 09-10-2021 21:26, Kovalenko Dmitry wrote:
Hello,
FB3.0.8.22506 (Dialect 3)
Firebird defines a follow result types for Negate operation:
-SMALLINT_COLUMN has result type SMALLINT
-INTEGER_COLUMN has result type INTEGER
As result, I see a work like this:
SQL> create table TTT2 (COL_SMALLINT SMALLINT);
SQL> insert into TTT2 values(-32768);
SQL> select -COL_SMALLINT from TTT2;
=======
Statement failed, SQLSTATE = 22003
Integer overflow. The result of an integer operation caused the most
significant bit of the result to carry.
It is OK?
Yes, this is normal. The range of a smallint is from -32768 to 32767, so
you can't negate -32768 as it will overflow back to -32768, hence it
will raise the integer overflow error.
Mark
--
Mark Rotteveel
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel