--本存储过程的功能:把test_tbl2中与test_tbl1中ID相同但salary不同的记录中的salary的值更新为test_tbl1中的salary的值
--创建存储过程create or replace procedure p_update_test_tbl2 is--定义游标 cursor c_test_tbl2 is select t1.id, t1.salary from test_tbl2 t2, test_tbl1 t1 where t2.id = t1.id and t2.salary <> t1.salary; c_row c_test_tbl2%rowtype;begin --使用游标进行更新 for c_row in c_test_tbl2 loop update test_tbl2 t2 set salary = c_row.salary where t2.id = c_row.id; end loop;end;--调用存储过程beginp_update_test_tbl2;end;