Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Getting a count on the number of affect rows
I think something like this might be faster:
CREATE or REPLACE PROCEDURE update_rows
(v_field IN number,
GHouck wrote:
> danalynn_at_my-dejanews.com wrote:
> >
> > Hello,
> >
> > I was wondering if there is a way to get the number of rows affected by a SQL
> > (insert/update) command (not in PL/SQL). I know you can use @@rowcount in
> > MSSQL, is there a similar variable in Oracle that I can use?
> >
> > Thanks.
> >
> > -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> > http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
> You could create a Trigger that simply counts in
> separate table when the table of interest experiences
> an INSERT or UPDATE.
>
> Something like:
>
> CREATE TABLE MYTABLE_COUNTER ( COUNTER );
>
> CREATE OR REPLACE TRIGGER MYTABLE_COUNTER
> BEFORE UPDATE ON MYTABLE
> FOR EACH ROW
> BEGIN
> UPDATE MYTABLE_COUNTER SET COUNTER=COUNTER+1;
> END;
>
> Probably not the most efficient method though,
> but relatively simple.
>
> Yours,
>
> Geoff Houck
> systems hk
> hksys_at_teleport.com
> http://www.teleport.com/~hksys
-Aina Blix Received on Tue Sep 29 1998 - 07:47:00 CDT