top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

how to get number of rows updated by an UPDATE statement in Oracle PL/SQL

+1 vote
112 views

declare
lc_status:='XXstatus';
Begin
Update xxtable
set Status_fg=lc_status
where con_bill_id=1234;

-- here i need to display how rows were updated.

end;

posted Sep 12, 2014 by Archana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
 
Best answer

declare
lc_status:='XXstatus';
Begin
Update xxtable
set Status_fg=lc_status
where con_bill_id=1234;
dbms_output.put_line(to_char(SQL%ROWCOUNT)||' rows were updated');
end;

answer Sep 12, 2014 by Vidhya Sagar
–1 vote

variable row_up varchar(30);

declare
lc_status:='XXstatus';
Begin
Update xxtable set Status_fg=lc_status where con_bill_id=1234;
:row_up:=(SQL%ROWCOUNT|| 'ROWS updated');
end;
/

print row_up

answer Sep 13, 2014 by Pradeep Kumar
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...