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

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

Re: One trigger operating on multipe tables .. possible ??

From: Rob Medley <medleyrk_at_iafrica.com>
Date: 1998/11/26
Message-ID: <365DB9FD.A8C50F3D@iafrica.com>#1/1

Hi,
A table can have many triggers, but a trigger can only fire on one table. You will need to create a trigger for every table.

Rob Medley
medleyrk_at_iafrica.com

Jørgen Haukland wrote:

> 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 Thu Nov 26 1998 - 00:00:00 CST

Original text of this message

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