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
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
Received on Mon Sep 28 1998 - 18:26:16 CDT