PL/SQL update counting rows - TechRepublic
Question
March 12, 2014 at 06:25 PM
john.a.wills

PL/SQL update counting rows

by john.a.wills . Updated 12 years, 2 months ago

I want to count the rows updated by my Update statement. What I envisage is something like this:
Update SuchAndSuchATable
Set col1 = ‘X’,
col2 = ‘Y’
WHERE col3 = ‘Z’
Returning count Into local_counter;
case local_counter
when 0
then
Alert (‘Nothing updated’);
when 1
then
null;
else
Alert (local_counter || ‘ rows got updated’);
end case;
The RETURNING phrase in (PL/)SQL does not do quite this, but surely there is some way it can be done.

This discussion is locked

All Comments