i have the following questing:
is it possible to reference the trigger transition tables (OLD_TABLE,
NEW_TABLE) inside a procedure which is called from a statement trigger?
e.g. i need a trigger
create trigger trig_u_a after update on a
referencing NEW_TABLE as new OLD_TABLE as old
for each statement
mode db2sql
begin atomic
values(proc_u_a(new, old));
end
the stored procedure for example should look like
create procedure proc_u_a(IN new tabletype, IN old tabletype)
language sql
...
insert into tab_c select new.col1, old.col1 ... from new, old
...
is this possible?
thanks
andreas lederer
CREATE SEQUENCE uid;
CREATE TABLE T1_NT AS (SELECT 1 AS id, T1.* FROM T1) DEFINITION ONLY;
CREATE TRIGGER ... AFTER .. ON T1 REFERENCING NEW_TABLE AS nt ....
BEGIN ATOMIC
INSERT INTO T1_NT SELECT NEXT VALUE FOR uid, NT.* FROM Nt;
VALUES (proc(PREVIOUS VALUE FOR uid));
DELETE FROM T1_NT WHERE id = PREVIOUS VALUE FOR uid;
END