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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Execute trigger on current row

Re: Execute trigger on current row

From: <bshah_at_sportsmail.com>
Date: 2000/09/21
Message-ID: <8qdgtd$8ug$1@nnrp1.deja.com>#1/1

In article <969513036.5033.0.pluto.d4ee154e_at_news.demon.nl>,   "Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote:
> Ever heard of using :new and :old in a trigger?
> This is always done by simply using
> :new.created = sysdate;
> in the trigger code, and definitely not by an update statement, which
 is
> also not going to work because of ora-4091.
> I strongly recommend to you reading Oracle provided documentation.

Thanks, but I tried this before and got an error: ORA-04082: NEW or OLD references not allowed in table level triggers. I looked through the oracle doc before and couldn't find anything (or any examples) triggering the current row w/o a WHERE statement.

>
> Regards,
>
> Sybrand Bakker, Oracle DBA
>
> <bhavinsh_at_my-deja.com> wrote in message
 news:8qc05v$flo$1_at_nnrp1.deja.com...
> > Hi,
> >
> > I'm trying to write a trigger that updates a date field
> > after an insert. However, I want to only update that
> > row's date field. I can't do a "where" qualification
> > because the fields they enter can vary.
> >
> > How would I update the field only for the inserted
> > row?
> >
> > Right now I have something like this which sets all the
> > dates in the table:
> > CREATE OR REPLACE TRIGGER CREATED_DATE AFTER INSERT ON
> > SOMETABLE
> > begin
> > UPDATE SOMETABLE SET created = sysdate;
> > end;
> > /
> >
> > Is there an "on current row" qualification of some sort?
> >
> > Oracle 8.1.6
> >
> > TIA
Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Sep 21 2000 - 00:00:00 CDT

Original text of this message

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