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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Trigger Help

Re: Trigger Help

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 22 Jul 1999 20:15:09 GMT
Message-ID: <37987b76.34298418@newshost.us.oracle.com>


A copy of this was sent to "Mark Young" <mark_a_young_at_worldnet.att.net> (if that email address didn't require changing) On Thu, 22 Jul 1999 15:35:43 -0400, you wrote:

>I would like to return the value of a field back to 0 once the value reaches
>1000 using a trigger
>
>I have the following:
> if (:new.senumber=1000) then
> begin
> update mytable set senumber=0 where mycondition=mycondition
> end;
> end if;
>

create or replace trigger SomeTrigger
before update of senumber on TableName
for each row
begin
  if ( :new.senumber = 1000 ) then

      :new.senumber := 0;
  end if;
end;
/

>The trigger will be executed on an update of the senumber column.
>
>Any help would be greatly appreciated.
>
>mark_a_young_at_worldnet.att.net
>
>
>
>

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Jul 22 1999 - 15:15:09 CDT

Original text of this message

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