Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: updating problems

RE: updating problems

From: Igor Neyman <ineyman_at_perceptron.com>
Date: Fri, 5 May 2006 08:48:19 -0400
Message-ID: <F4C27E77F7A33E4CA98C19A9DC6722A2E7CDA6@EXCHANGE.corp.perceptron.com>


First, you should do this in "before" trigger. Second, you don't need "update" statement in the trigger (just do an "assignment").  

create or replace trigger my_trig

   before update of a on tab for each row    begin

      :new.b = current_timestamp;
   end;
/

And third, read some oracle docs.

Igor

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Simone Saravalli Sent: Friday, May 05, 2006 8:42 AM
To: oracle-l
Subject: Fwd: updating problems

2006/5/5, Ghassan Salem <salem.ghassan_at_gmail.com>:
> Simone,
> Can you post the code of your trigger?

Yes, this is an example of the table I want to update:

create table tab (

   a number not null,
   b date default current_timestamp
);

and then the trigger

create or replace trigger my_trig

   after update of a on tab for each row    begin

      update tab set b = current_timestamp where a=:new.a;    end;
/

Now I've written:

create or replace trigger my_trig

   after update of a on tab for each row    begin

      update tab set :new.b = current_timestamp where a = :new.a;    end;
/

but the trigger gets some compilation errors. Is it correct?

Thanks, Simone Saravalli

--
http://www.freelists.org/webpage/oracle-l



--
http://www.freelists.org/webpage/oracle-l
Received on Fri May 05 2006 - 07:48:19 CDT

Original text of this message

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