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 -> Re: Trigger on table with many fields

Re: Trigger on table with many fields

From: Jim Kennedy <kennedy-downwithspammersfamily_at_attbi.net>
Date: Sat, 3 Sep 2005 06:29:20 -0700
Message-ID: <bJydnZ2dnZ3FJKSdnZ2dnXg5hN6dnZ2dRVn-yZ2dnZ0@comcast.com>

"michaelg" <mikespanien_at_hotmail.com> wrote in message news:1125733203.521333.189690_at_g47g2000cwa.googlegroups.com...
> Hi there,
>
> I have a problem using a trigger on a table with many field (>150).
> This is the trigger :
>
> create or replace trigger trg_tst
> after insert or update on tst_table1
> For each row
> declare lfd number(10);
> begin
> select test_seq.nextval into lfd from dual;
> insert into tst_table2
> values
> (:new.field1,
> :new.field2,
> :new.field3,
> .
> .
> :new.field150
> lfd);
> end:
>
> The field2 of table1 and table2 are the same, but table2 has added one
> field (seq_nr).
>
> The trigger works fine, but because of internal reasons in our system
> we save the trigger, when table1 is deleted and recreate it when table1
> gets created. But the table where it is saved, is quite short and it is
> not possible to change it, so the trigger body is cut offed. Do you
> have any ideas, how to optimize this trigger, to get it shorter ? I
> thought to call a function, which fills the field, but I am quite
> newbie in Oracle.
>
> Hope s.o. can help me
>
> Thanks in advance
>
> Mike
>

What do you mean that table 1 is deleted and created? I hope you are not dropping and recreating table 1 all the time. That is poor design. Jim Received on Sat Sep 03 2005 - 08:29:20 CDT

Original text of this message

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