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: Mutating from trigger

Re: Mutating from trigger

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 22 Mar 2001 21:56:44 +0100
Message-ID: <tbkpkhig10fi57@beta-news.demon.nl>

"Galen Boyer" <galenboyer_at_yahoo.com> wrote in message news:ug0g5v9sk.fsf_at_yahoo.com...
> Okay,
>
> I'm not too sure about google and what is bringing back, so I
> will ask probably a common question here.
>
> A trigger cannot update a column in the row that is currently
> being updated?
>
> Then, how does one use the database to set a specific field when
> an application is executing the update. We are trying not to use
> the application to take care of modification dates, but instead
> of, have the database do it.
>
> --
> Galen Boyer
> I like to skate on the other side of the ice.

Just a few very general guidelines as your post is very vague 1 You can not in a trigger select from the table you are updating 2 You can not update *other* rows (mark the distinction) different from the row you are currently updating
3 You can update the current row by simply *assigning* the desired value to :new.<columname> (You very often see people updating the current row by means of an update statement. There's no need for it) 4 You can resolve the problem under 2
by
- before update on statement level creating a pl/sql table. The pl/sql table is going to buffer the primary keys
- after update for each row save the primary key in your pl/sql table - after update on statement level loop through your pl/sql table and do whatever you need to do.

Hth,

Sybrand Bakker, Oracle DBA Received on Thu Mar 22 2001 - 14:56:44 CST

Original text of this message

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