Home » SQL & PL/SQL » SQL & PL/SQL » new and old in triggers (oracle10g)
new and old in triggers [message #382550] Thu, 22 January 2009 22:27 Go to next message
rajasekhar857
Messages: 500
Registered: December 2008
Senior Member
hi,

is it possible to use new and old references in statement level trigger at any time or at any where
Re: new and old in triggers [message #382554 is a reply to message #382550] Thu, 22 January 2009 23:23 Go to previous messageGo to next message
Michel Cadot
Messages: 64135
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No.
OLD does not exist for insert.
NEW does not exist for delete.
These are examples read more about triggers in Application Developer's Guide - Fundamentals, there is a whole chapter on them.

Regards
Michel

[Updated on: Thu, 22 January 2009 23:24]

Report message to a moderator

Re: new and old in triggers [message #382555 is a reply to message #382550] Fri, 23 January 2009 00:00 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
SQL> create or replace trigger tst_ais
  2  after insert on tst
  3  begin
  4    :new.id := 1;
  5  end;
  6  /
create or replace trigger tst_ais
                          *
ERROR at line 1:
ORA-04082: NEW or OLD references not allowed in table level triggers


And this makes sense: what record would :new or :old refer to? Statement level triggers fire after a set of records have been handled.
Re: new and old in triggers [message #382590 is a reply to message #382550] Fri, 23 January 2009 02:40 Go to previous messageGo to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
i think it is possible only before insert or update
yours
dr.s.raghunathan
Re: new and old in triggers [message #382592 is a reply to message #382590] Fri, 23 January 2009 02:55 Go to previous messageGo to next message
Michel Cadot
Messages: 64135
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I think you didn't carefully read answers and documentation.

Regards
Michel
Re: new and old in triggers [message #382596 is a reply to message #382592] Fri, 23 January 2009 03:03 Go to previous message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
yes, i missed the answeres and full documentation. i just replied based on the receipt of email notification. any way mistake is the mistake
yours
dr.s.raghunathan
Previous Topic: how to chnage a customer_id
Next Topic: Reading "Or" Operator (merged)
Goto Forum:
  


Current Time: Thu Dec 08 06:03:32 CST 2016

Total time taken to generate the page: 0.07198 seconds