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
recreate exception foo 'Invalid value detected: @1';
set list on;
set echo on;
set term ^;
execute block as
declare x smallint; -- 'x' is NOT initialized
begin
x = 33000; -- make 'x' too big to fit in smallint via direct assignment
when any do
begin
exception foo using(:x);
end
end
^
execute block as
declare x smallint = 33; -- 'x' is initialized
begin
x = 33000; -- make 'x' too big to fit in smallint via direct assignment
when any do
begin
exception foo using(:x);
end
end
^
execute block as
declare x smallint = 33; -- 'x' is initialized
begin
x = x * 1000; -- make 'x' too big to fit in smallint via arithmetic expression
when any do
begin
exception foo using(:x);
end
end
^
set term ;^
First exception text (with "-Invalid value detected: *** null ***") can be easy explained: statement did not change variable content which was null at the beginning.
Second and third messages produces NOT invalid value but its complementation to 65536 with minus sign.
The text was updated successfully, but these errors were encountered:
Submitted by: @pavel-zotov
Consider script:
recreate exception foo 'Invalid value detected: @1';
set list on;
set echo on;
set term ^;
execute block as
declare x smallint; -- 'x' is NOT initialized
begin
x = 33000; -- make 'x' too big to fit in smallint via direct assignment
when any do
begin
exception foo using(:x);
end
end
^
execute block as
declare x smallint = 33; -- 'x' is initialized
begin
x = 33000; -- make 'x' too big to fit in smallint via direct assignment
when any do
begin
exception foo using(:x);
end
end
^
execute block as
declare x smallint = 33; -- 'x' is initialized
begin
x = x * 1000; -- make 'x' too big to fit in smallint via arithmetic expression
when any do
begin
exception foo using(:x);
end
end
^
set term ;^
select 33000 - 65536 from rdb$database;
It's STDERR will be:
Statement failed, SQLSTATE = HY000
exception 46
-FOO
-Invalid value detected: *** null ***
-At block line: 7, col: 13
Statement failed, SQLSTATE = HY000
exception 46
-FOO
-Invalid value detected: -32536
-At block line: 7, col: 13
Statement failed, SQLSTATE = HY000
exception 46
-FOO
-Invalid value detected: -32536
-At block line: 7, col: 13
First exception text (with "-Invalid value detected: *** null ***") can be easy explained: statement did not change variable content which was null at the beginning.
Second and third messages produces NOT invalid value but its complementation to 65536 with minus sign.
The text was updated successfully, but these errors were encountered: