declare
cursor cur_dept is select dname from dept;
v_dname dept.dname%type;
v_cnt integer;
begin
select count(deptno) into v_cnt from dept;open cur_dept;
loop
fetch cur_dept into v_dname;
exit when cur_dept%notfound;
if cur_dept%rowcount=1 thendbms_output.put_line(v_dname);
end if;
if cur_dept%rowcount=v_cnt thendbms_output.put_line(v_dname);
end if;
end loop;
close cur_dept;
end;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-713228/
,如需转载,请注明出处,否则将追究法律责任。