Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: NEW / OLD in triiger
A copy of this was sent to "John Bester" <johnb_at_iconnect.co.za>
(if that email address didn't require changing)
On Wed, 15 Jul 1998 16:06:40 +0200, you wrote:
>Since the oracle documentation does not give any usefull trigger examples,
>I'm posting this question:
>
>How do I access / change values of rows inserted / modified rows from within
>a trigger. I am used to the MSSQL syntax, but there are no descent examples
>(or descriptions) on using NEW an OLD in a trigger. Do I treat them as
>tables? I seem to get a warning everytime I try to access them.
>
>Any examples will be much appreciated.
>---
>John Bester
>johnb_at_iconnect.co.za
>
>
did you see chapter 9 in the v7 Application Developers Guide or chapter 13 in the v8 doc set? Its all about triggers....
Anyway, you access them like records, for example:
create or replace trigger emp_trigger
before insert on emp
for each row
begin
:new.ename := upper( :new.ename );
end;
You have access to :new in INSERT and UPDATE triggers and :old in UPDATE and DELETE triggers....
hope this helps..
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed Jul 15 1998 - 21:02:01 CDT
![]() |
![]() |