declare
type cl is ref cursor;
emp_cursor cl;
v_ename emp.ename%type;
v_sal emp.sal%type;
begin
open emp_cursor for
select ename,sal from emp where deptno =10;
loop
fetch emp_cursor into v_ename,v_sal;
exit when emp_cursor%notfound;
dbms_output.put_line(v_ename);
end loop;
close emp_cursor;
end;
我在plsql中执行的就是这段脚本
type cl is ref cursor;
emp_cursor cl;
v_ename emp.ename%type;
v_sal emp.sal%type;
begin
open emp_cursor for
select ename,sal from emp where deptno =10;
loop
fetch emp_cursor into v_ename,v_sal;
exit when emp_cursor%notfound;
dbms_output.put_line(v_ename);
end loop;
close emp_cursor;
end;
我在plsql中执行的就是这段脚本
解决方案 »
- Oracle参看正在运行的SQL怎么看,其工具是啥?
- 请教sql语句
- cannot read from file 201 because it failed verification tests
- 一不小心删除了Oracle的节点,怎么办,要不要重新安装Oracle,怎么还原?
- oracle存储过程传入varchar型参数用于查询中in的问题
- VB中调用存储过程对oracle进行操作,在8i的客户端,.Properties.Item("SPPrmsLOB") = True 在对应所需名称或序数的集合中,未找到项目
- 问一个关于oracle中的序列(sequence)的问题!
- 有关显示列的问题
- 请教:occi编译问题!
- 请问关于Long型
- Oracle9i 协议适配器错误 如何解决?
- 存储bfile类型的数据
你写的匿名块语法没问题 是你的权限问题 直接给个dba权限
grant select on v$session to user
grant select on v$statname to user
grant select on v$sesstat to user
grant select on v$mystat to user
在根据提示的视图跟授权