Home » SQL & PL/SQL » SQL & PL/SQL » logging
logging [message #245876] Tue, 19 June 2007 02:43 Go to next message
ninja17
Messages: 12
Registered: June 2007
Junior Member
I have procedure that updates many rows in 5 tables,

begin

update Table1 set .... where ..

update Table1 set ... where ..

...

and I want to create some logging of what was updated ( for example : 1st table : updated 4673 of 5000 rows , 2nd table ....) Could you suggest me something pls ? I dont know how to start
Re: logging [message #245880 is a reply to message #245876] Tue, 19 June 2007 02:48 Go to previous message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
You might use SQL%ROWCOUNT within a pl/sql block
something like

Begin

UPDATE tab1 set col = val where condition;

INSERT INTO log tab (tabname, rows) VALUES ('Table1', SQL%ROWCOUNT);


UPDATE tab2 set col = val where condition;

INSERT INTO log tab (tabname, rows) VALUES ('Table2', SQL%ROWCOUNT);

...
END;
Previous Topic: DBMS_obfuscation package
Next Topic: how to combine the conditions
Goto Forum:
  


Current Time: Thu Dec 12 07:52:37 CST 2024