declare
cursor c_test_tbl2 is
select t2.id, t2.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
dbms_output.put_line(c_row.id || '-' || c_row.salary);
end loop;
end;
PLsql中,输出结果如下: