Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Wanted : Help on M u t a t i n g trigger
Hi,
I'm having troubles with a mutating trigger here ...
Here's an example of what I'm trying to do ...
CREATE TRIGGER my_table_b_d_r
BEFORE DELETE ON my_table
FOR EACH ROW
--
DECLARE
v_my_parent VARCHAR2(20);
--
BEGIN
--
SELECT name_child INTO v_my_parent
FROM my_table
WHERE child_nr = :OLD.child_parent;
--
INSERT INTO my_table_his
(sequence, name_child, name_parent, date)
VALUES
(:OLD.sequence, :OLD.name_child, v_my_parent, sysdate);
--
END;
In other words ...
My record in the history contains the name of the child_rec and also the
name of the parent_rec.
I already tried to solve this using a function to get the child_rec_name, declared in the following package with "PRAGMA RESTRICT_REFERENCES" :
create or replace package organigram as FUNCTION get_description(i_seq IN NUMBER) RETURN VARCHAR2; PRAGMA RESTRICT_REFERENCES(get_description, WNDS, WNPS, RNPS); end organigram;
But as you might have guessed , this stuff doesn't work with triggers ...
So , anyone knows what to do in a situation like this ???
Thanks !!!
Greetings
D. Vanmarcke
Junior DBA
Received on Tue Oct 13 1998 - 05:42:45 CDT