Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Mutating from trigger
"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
![]() |
![]() |