Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> One trigger operating on multipe tables .. possible ??

One trigger operating on multipe tables .. possible ??

From: Jørgen Haukland <jorgen.hauikland_at_fou.telenor.no>
Date: 1998/11/25
Message-ID: <73hiha$e0i@info.telenor.no>#1/1

Hello all !

Thanks to You all for asking/answering and making this one of the best groups on the net for an Oracle newbie.

My question is: How do I get my "primary_key_insert_trigger" to work on all the tables in my dB ?

Here's my trigger:
(I have a sequence named insert_pk)

CREATE OR REPLACE TRIGGER trigger_pk

	    BEFORE INSERT ON table_a, table_b, table_c -- and so on ....
	    REFERENCING NEW AS n
	    FOR EACH ROW
DECLARE
	    new_key INTEGER;

BEGIN
    SELECT insert_pk.NEXTVAL INTO new_key FROM DUAL;

            :n.pk_field_on_table := new_key;
END; As it is for now I can only get this to work on table_a. Do I have to create this trigger for every table ?

thanks for any help !!

-jh
NORWAY Received on Wed Nov 25 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US