Monday, June 4, 2018

how many rows update using loop in oracle using pl/sql procedure

set serveroutput on


declare

cursor c1 is

select a,B from ab;

counter integer := 0;

begin

for cr in c1 loop

update item

set BASIC_PRICE=cr.b

where itemcode=cr.a;

counter := counter + sql%rowcount;

end loop;

dbms_output.put_line('Number of total lines affected update operation: '||counter);

end;

/



Number of total lines affected update operation: 128

PL/SQL procedure successfully completed.

No comments:

Post a Comment

Horizontal Scaling vs Vertical Scaling

 একটা application হঠাৎ করে অনেক বেশি user পেতে শুরু করল। আগে যেখানে ১,০০০ জন user ছিল, এখন সেখানে ১ লাখ user! তখন স্বাভাবিকভাবেই প্রশ্ন আসে—...