--游标的使用 步骤1、声明游标 2、打开游标 3、获取数据 4、关闭游标 declare cursor cur is select * from emp; t_sal cur%rowtype; begin open cur; loop fetch cur into t_sal; exit when cur%notfound; dbms_output.put_line(t_sal.ename || ':' || t_sal.sal); end loop; close cur; end;
--游标的使用 步骤1、声明游标 2、打开游标 3、获取数据 4、关闭游标 declare cursor cur is select * from emp; t_sal cur%rowtype; begin open cur; loop fetch cur into t_sal; exit when cur%notfound; dbms_output.put_line(t_sal.ename || ':' || t_sal.sal); end loop; close cur; end;