plsqlus 游标的简单实例

Set  serveroutput  on;
%ISOPEN : 判断游标是否打开的
%FOUND游标发现数据
%NOTFOUND 游标没有发现数据
%ROWCOUNT 游标可以遍历的记录数量
create or replace procedure cursortest
is
employeename varchar2(20);
employeejob varchar2(9);
employeesal number(7,2);
cursor cselectemp
is
select ename,job,sal
from scott.emp;
	begin
	open cselectemp;
	loop	
	fetch cselectemp
	into employeename,employeejob,employeesal;
	exit when cselectemp%notfound;
	dbms_output.put_line('employeename is '
||employeename
||'employeejob is '
||employeejob
||'employeesal is '
||employeesal					
);
end loop;
close cselectemp;
end;


你可能感兴趣的:(plsqlus 游标的简单实例)