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: Basic trigger question

Re: Basic trigger question

From: J.Patrick <pat_at_mindwrap.com>
Date: 28 Sep 2001 07:13:56 -0700
Message-ID: <73e908ac.0109280613.61344d83@posting.google.com>


"Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote in message news:<tr75vpremmjrf6_at_news.demon.nl>...
> "J.Patrick" <pat_at_mindwrap.com> wrote in message
> news:73e908ac.0109271252.35c9836a_at_posting.google.com...
> > pat_at_mindwrap.com (J.Patrick) wrote in message
> news:<73e908ac.0109270632.41131161_at_posting.google.com>...
> > > Can you have a trigger that performs a function on the same table that
> > > initiates the trigger. For example a trigger created like this:
> > >
> > >
> > > create or replace trigger [trigger name]
> > > after insert or update on table_abc
> > > for each row
> > > begin
> > > update table_abc set odcomments = concat(column1, column2, column3);
> > > end;
> > >
> > >
> > > If not... does anyone have any suggestions to do what seems like a
> simple action?

Sybrand,

This trigger returns error:

ERROR at line 1:
ORA-04082: NEW or OLD references not allowed in table level triggers

Think I'm missing some concept.

Thanks for the assistance.

Pat

> > >
> > > Thanks very much.
> > >
> > >
> > > Pat
> >
> > Guess I should show the actual trigger I am working with rather that just
> examples.
> >
> > This what I have. I know it's probably way off.
> >
> > create or replace trigger conf2tech
> > after insert on techtest
> > BEGIN
> > update table techtest t
> > SET :new.company_name =
> > (SELECT company_name
> > FROM client_config c
> > WHERE a.serial_num = c.serial_num )
> > END;
> > /
>
>
> create or replace trigger conf2tech
> after insert on techtest
> BEGIN
> SELECT company_name
> into :new.company_name
> FROM client_config c
> WHERE c.serial_num = :new.serial_num; -- as the a alias occurs nowhere
> END;
> /
>
> Regards,
>
> Sybrand Bakker, Senior Oracle DBA
Received on Fri Sep 28 2001 - 09:13:56 CDT

Original text of this message

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