Monday, September 2, 2019

how to update table using cursor with number of total update rows display in sql command

set serveroutput on

DECLARE 
   total_rows number(2); 
BEGIN 
   UPDATE  STUDENT 
   SET CITY = 'Dhaka'
   where stid in ('1','2'); 
   IF sql%notfound THEN 
      dbms_output.put_line('no customers updated'); 
   ELSIF sql%found THEN 
      total_rows := sql%rowcount; 
      dbms_output.put_line( total_rows || ' customers updated '); 
   END IF; 
END; 
/

No comments:

Post a Comment

 https://www.linkedin.com/pulse/building-real-time-database-monitoring-dashboard-oracle-khaleeq-tpwxf/