create procedure bulk_deno1(
i_deptno in number
)
is
cursor emp_cur(icur_deptno number)
is
select empno,ename from emp where deptno=icur_deptno;
type t_empno is table of emp.empno%type index by binary_integer;
type t_ename is table of emp.ename%type index by binary_integer;
empno_col t_empno;
ename_col t_ename;
begin
open emp_cur(i_deptno);
fetch emp_cur bulk
into empno_col,ename_col;
dbms_output.put_line('编号'||'名字 ');
close emp_cur;
for I in 1 ... empno_col.count loop
dbms_output.put_line(empno_col(i) ||' '||ename_col(i));
end;
end;
/
i_deptno in number
)
is
cursor emp_cur(icur_deptno number)
is
select empno,ename from emp where deptno=icur_deptno;
type t_empno is table of emp.empno%type index by binary_integer;
type t_ename is table of emp.ename%type index by binary_integer;
empno_col t_empno;
ename_col t_ename;
begin
open emp_cur(i_deptno);
fetch emp_cur bulk
into empno_col,ename_col;
dbms_output.put_line('编号'||'名字 ');
close emp_cur;
for I in 1 ... empno_col.count loop
dbms_output.put_line(empno_col(i) ||' '||ename_col(i));
end;
end;
/
解决方案 »
- 查看当前用户没有角色
- Oracle 备份策略
- 奇怪的SQL语句 求助(分少请原谅)
- 怎么通过一个存储过程连接另外一个用户?帮忙看看
- oracle 大字段的内容如何循环输出
- 游标最后一条重复问题
- SQL> connect /as sysdba SQL> connect /as sysdba SQL> grant select on hr.employees to scott;ORA-01031: 权限不足 这怎么可能呢?
- 怎样把表中的数据按一定的条件分成段
- 在oracle下如何用一个表更新另一个表?
- 有关UTL_FILE的问题
- The Network Adapter could not establish the connection这个怎么解决
- 关于 not exists
fetch emp_cur bulk
--应是
fetch emp_cur bulk collect
for I in 1 ... empno_col.count loop
dbms_output.put_line(empno_col(i) ||' '||ename_col(i));
end;
--此处还少个loop吧
for I in 1 ... empno_col.count loop
dbms_output.put_line(empno_col(i) ||' '||ename_col(i));
end loop;
--改为
for I in 1 .. empno_col.count loop
直接show errors或show error就可以看到错误了