Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: -- insert instead of an update
"Andre" <avanrossem_at_hotmail.com> a écrit dans le message news:
4d32d1be.0311190134.7b49ac68_at_posting.google.com...
> Hello all,
>
> I want to do the following:
>
> If a record is updated I have made an before update trigger which is
triggered.
> What I want to do is, instead of an update, do an insert on the same
table.
>
> So modifying a record will insert an extra record in the table.
>
> Is this possible??
>
> Thanks for all comments,
> Andre The Netherlands
What is your purpose ?
Do you want to track changes on a row by inserting a new corresponding to
the :old values
and doing this way a historical table (this is actually what i'm presently
coding)
Or, you may want to prevent updates to occur on the table (is it what you
mean by saying insert *instead* of update ?)
Rollback and commit are forbidden within the code of a trigger, therefore
you cannot cancel a DML statement from within the trigger fired by that
statement.
A possible way to do is to prevent user from doing updates (by revoking
update grant for the table)
and performing updates through a pl/sql procedure.
Alkos Received on Wed Nov 19 2003 - 03:54:15 CST