| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger compilation problem
Thanks a lot for your help. I appreciate it. I was kind of confused the
answer given by the first replier but thanks for making it clear with a
crystal clear answer. Regards
"Andy Hassall" <andy_at_andyh.org> wrote in message
news:14plsu4v1j8c9e54n8dtdcrus55cudk9s7_at_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 Fri Nov 08 2002 - 00:05:29 CST
![]() |
![]() |