top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

+1 vote
547 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
...