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: Need info on Triggers

Re: Need info on Triggers

From: Lando <Markl_at_plant.pnwss.com>
Date: 1997/02/11
Message-ID: <01bc1856$d8fdd860$2a868cc6@quebim.quebim>#1/1

PKA <praveen_andugula_at_nt.com> wrote in article <330082EB.285E_at_nt.com>...
> Hi
> I have a table with many columns( x,y,z). I need to capture changes to
> the table. I need to capture changes only for(x) some specific columns,
> but not
> for all columns. for ex: I need to capture updates for column x, but not
> for columns y & Z. I also need to capture deletes from the table.
> I know that i have to write a trigger to capture changes to the table.
> my question is wether one trigger is enough to capture changes to
> various columns or i need one trigger each to capture changes.
> please advise. any additional input on triggers is welcome
>
> please send replies if possible to the following address
> praveen_andugula_at_nt.com
>
> thanks
> praveen
>

Using a for each row trigger you can check for what type of action is taking place (update,insert,delete) and you can check individual columns in the case of updating.
For example:

create or replace trigger testtab_trg
after
update,insert,delete on testtab
for each row
declare

begin

  if (deleting) then
    do_something;

  If (inserting) then

     do_something;

  if (updating) then
    do_something;

  if (updating 'X') then

     do_something_else;
  end if;

end;

M.Landa Received on Tue Feb 11 1997 - 00:00:00 CST

Original text of this message

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