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: Trigger compilation problem

Re: Trigger compilation problem

From: Andy Hassall <andy_at_andyh.org>
Date: Thu, 07 Nov 2002 22:18:50 +0000
Message-ID: <14plsu4v1j8c9e54n8dtdcrus55cudk9s7@4ax.com>


On Thu, 07 Nov 2002 22:25:12 +0100, Sybrand Bakker <gooiditweg_at_sybrandb.demon.nl> wrote:

>> values(:old.employee_id, :old.last_name, :old.first_name,
>>:old.middle_initial,
>> :old.title, old,supervisor_id, username, timestamp);

 To the OP: presumably should be :old.supervisor_id, not old,supervisor_id.

>b) :old is not available in after update triggers. You need to use a
>before update trigger

 Yes it is:

SQL> create table t1 (n1 number);

Table created

SQL> create table t2 (n2 number);

Table created

SQL> insert into t1 values (1);

1 row inserted

SQL> commit;

Commit complete

SQL> create trigger trig1
  2 after update on t1 for each row
  3 begin
  4 insert into t2 (n2) values (:old.n1);   5 end;
  6 /

Trigger created

SQL> update t1 set n1 = 2;

1 row updated

SQL> commit;

Commit complete

SQL> select * from t2;

        N2


         1

-- 
Andy Hassall (andy@andyh.org) icq(5747695) http://www.andyh.org
http://www.andyhsoftware.co.uk/space | disk usage analysis tool
Received on Thu Nov 07 2002 - 16:18:50 CST

Original text of this message

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