Hello Serge,
(Using DB2 8.2/Linux)
Hi All,
I'd like to get feedback (through email) from folks who use CALL in
Trigger and do or do not get in trouble with the -746 SQLCODE:
SQL0746N Routine "<routine-name>" (specific name "<specific-name>")
violated nested SQL statement rules when attempting to perform
operation "<operation>" on table "<table-name>".
Cheers
Serge
Here you've got it:
create table a (a integer)
@
create procedure b1(i_a integer)
begin
insert into a values (i_a);
end
@
create table b (a integer)
@
create trigger t_b after insert on b referencing new as nuevo for each
row mode db2sql
begin atomic
call b1(nuevo.a);
call b1(nuevo.a);
--insert into a values (nuevo.a);
--insert into a values (nuevo.a);
end
@
insert into b values (0)
@
insert into b values (1)
@
insert into b values (2)
@
select * from a
@
drop table b
@
drop procedure b1
@
drop table a
@
drop trigger t_b
@
Commenting the CALLs and uncommenting the INSERTs works fine. CALL
works if there's only one CALL.
Needless to say I'm desperate with this one.