oracle cursor游标循环比较游标元素是否相同

  上文测试了oracle plsql循环比较集合元素是否相同
 http://space.itpub.net/9240380/viewspace-713314
随即又测试如下代码:

declare
cursor cur_emp is select deptno from emp order by deptno;
v_deptno emp.deptno%type;
v_1 emp.deptno%type;
begin
open cur_emp;
loop
fetch cur_emp into v_deptno;
exit when cur_emp%notfound;
if cur_emp%rowcount=1 then
dbms_output.put_line(v_deptno);
end if;
if v_1!=v_deptno then
dbms_output.put_line(v_deptno);
end if;
v_1:=v_deptno;
end loop;
close cur_emp;
end;

备注:
   测试表数据皆一致,俱为oracle之scott用户的emp表
请使用浏览器的分享功能分享到微信等