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: AffectedRecords in an Update Trigger

Re: AffectedRecords in an Update Trigger

From: Waldek Karczmarczyk <wak_at_abg.com.pl>
Date: Fri, 12 Nov 1999 18:11:08 +0100
Message-ID: <80hg36$1n02$1@news.ipartners.pl>


Hi,
I'd use a combination of triggers and a package to determine number of records affected by an update:

create or replace package pCount as

   procedure clear;
   procedure inc;
   function result return number;
end;

create or replace package body pCount as

   xCount number := 0;
   procedure clear is begin xCount := 0; end;    procedure inc is begin xCount := xCount + 1; end;    function result return number is begin return xCount; end; end;

create trigger trig_1
before update on TABLE_1
begin

   pCount.clear;
end;

create trigger trig_2
after update on TABLE_1 FOR EACH ROW
begin

   pCount.inc;
   dbms_output.put_line('Updating row #: '||to_char(pCount.result)); end;

create trigger trig_3
after update on TABLE_1
begin

   dbms_output.put_line('Total # of updated rows : '||to_char(pCount.result));
end;

Waldek Karczmarczyk, ABG SA
wak_at_abg.com.pl

Jerry Deal wrote in message <80fi4u$s3$1_at_news.xmission.com>...
>Is there a way to trap the number of Affected Records in an update trigger?
>
>
Received on Fri Nov 12 1999 - 11:11:08 CST

Original text of this message

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