Home » SQL & PL/SQL » SQL & PL/SQL » setting SQL%ROWCOUNT in stored procedure
setting SQL%ROWCOUNT in stored procedure [message #283649] Tue, 27 November 2007 17:12 Go to next message
gthiruva
Messages: 9
Registered: November 2007
Junior Member
Anyone know if there's a way to manually set the value of SQL%ROWCOUNT?

I have a stored procedure that is called to update several rows of a table - but they are updated serially. The procedure is called from an OCI program that thinks the stored procedure call is an update statement - and thus it checks SQL%ROWCOUNT to see how many rows were updated. I cannot make any changes to the OCI program.

So, to get the OCI program to accurately know how many rows were updated, I need to find a way to manipulate SQL%ROWCOUNT from within the stored procedure call.

Any ideas?
Re: setting SQL%ROWCOUNT in stored procedure [message #283650 is a reply to message #283649] Tue, 27 November 2007 17:53 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Pseudocode...
...
n :=0;

LOOP...
-- running total
n:= n + sql%rowcount;
END LOOP;

update my_dummy_table set x=x where rownum <= n;

if sql%rowcount != n then
  error!
end if;

[Updated on: Tue, 27 November 2007 18:07]

Report message to a moderator

Previous Topic: Dynamic SQL
Next Topic: Date as column header and below result
Goto Forum:
  


Current Time: Sat Dec 03 12:18:39 CST 2016

Total time taken to generate the page: 0.05072 seconds