Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

number of rows beeing updated?

Status
Not open for further replies.

ija

Programmer
Feb 13, 2002
38
CZ
How can I get number of rows, which were updated (or inserted) by a statement? You might get a better insight into my problem, when you have a look on the following statement:
[tt]
update MYTAB
set ROW_STAT = 'SOME STATUS'
where KEY = 'SOME KEY'
returning count(*) into Cnt;
[/tt]

This statement does not work... :-(

I need to know the count, because I have another table with totals of records in each state. The problem is, that there are several processes running in parallel and they can read results of updates done by other processes.

Help please!
 
Ooops? More details please.
I found %rowcount in documentation and it is a CURSOR attribute. I do not use cursor... And I do not want to, because it is too slow for our purpose.
Could you please send an example of how it should be used?
 
This is an implicit cursor attribute. you need not use any cursor for using this. just after your update statement, give this line.

dbms_output.put_line(sql%rowcount);

you will see the number of rows affected by the previously executed dml statement.
 
Ok. I tried and it works. Thanks a lot. :)

Do you have an idea how fast this is? Does it have the value from the last statement or runs it another query in the database?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top