09.05.2014 13:52, Mark Rotteveel wrote:
> So although multiple WHENs might be handy, they are - afaik - currently
> not allowed, and this limitation can be worked around.

   Actually, according to my test, they are allowed now, but their behavior 
seems strange 
to me. That's why I ask.
   For example: what result you would expect from following code?

drop table s_test;
set echo on;
create table s_test (f integer);
recreate table errs(f integer, msg varchar(30));
set term ^;
create trigger boom for s_test after update or insert as
declare variable a integer;
begin
  if (new.f>=10) then
   begin
    a = 1/0;
   end
end^
insert into s_test values (1)^
commit^
execute block as
declare variable a integer;
begin
  update s_test set f=2;
  begin
   update s_test set f=3;
   begin
    update s_test set f=4;
    begin
     update s_test set f=10;
    end
   when gdscode arith_except do insert into errs (f, msg) select f, 'gdscode 
'||gdscode 
from s_test;
   when sqlcode -802 do insert into errs (f, msg) select f, 'sqlcode '||sqlcode 
from s_test;
   when any do insert into errs (f, msg) select f, 'any' from s_test;
   end
  when any do insert into errs (f, msg) select f, 'any2' from s_test;
  end
end^
commit^
select f from s_test^
select * from errs^
commit^
set term ;^

   I would expect either three records in errs table or one. But really there 
are two. 
Surprise.

-- 
   WBR, SD.

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to