set serveroutput on ;declare cursor yan_cur is select * from yanyan ;
type yan_table is table of yanyan%rowtype;
yan_tab yan_table;
begin open yan_cur;
loop
fetch yan_cur bulk collect into yan_tab limit 2;
for i in 1...yan_tab.count loop
dbms_output.put_line('学号:'||yan_tab(i).xh||'姓名:'
||yan_tab(i).xm||'工资:'||yan_tab(i).sal);
end loop;
exit when yan_cur%notfound;
end loop;
close yan_cur;
end;/
显示Error at line 3
ORA-06550: line 17, column 13:
PLS-00103: Encountered the symbol "." when expecting one of the following: * & - + / at mod remainder rem .. <an exponent (**)> ||
multiset要怎么改求教
type yan_table is table of yanyan%rowtype;
yan_tab yan_table;
begin open yan_cur;
loop
fetch yan_cur bulk collect into yan_tab limit 2;
for i in 1...yan_tab.count loop
dbms_output.put_line('学号:'||yan_tab(i).xh||'姓名:'
||yan_tab(i).xm||'工资:'||yan_tab(i).sal);
end loop;
exit when yan_cur%notfound;
end loop;
close yan_cur;
end;/
显示Error at line 3
ORA-06550: line 17, column 13:
PLS-00103: Encountered the symbol "." when expecting one of the following: * & - + / at mod remainder rem .. <an exponent (**)> ||
multiset要怎么改求教
解决方案 »
- 一个用户 对应 多表空间
- 请教Oracle存储过程的一个问题
- 求高手帮写一个SQL语句,在线等..........
- 大哥大姐进来看一看创建对象带上not instantiable选项为什么会出现这种错误
- 求一分组查询语句!
- 求一简单SQL语句
- 出现ORA-12571: TNS: 包写入程序失败,请帮忙
- 如何将Interbase数据库导入到ORACLE中相应表中
- sql问题2:
- 面试题:用sql语句查询十条关于A、B、C、D的记录怎么写?请各位大神帮忙解答,谢谢
- 求一条sql,在oracle的scott用户下查询各部门工资排在前三名员工的部门编号,部门名称,姓名,工资
- 在ubuntu下安装了oracle11.2g,可是怎么也进不去,求解。
1) for i in 1..yan_tab.count
这里是2个点
2)你已经用了bulk collect into,一次性把所有记录提取到yan_tab中,就不需要外层的loop了declare
cursor yan_cur is select * from yanyan ;
type yan_table is table of yanyan%rowtype;
yan_tab yan_table;
begin
open yan_cur;
fetch yan_cur bulk collect into yan_tab limit 2;
for i in 1..yan_tab.count loop
dbms_output.put_line('学号:'||yan_tab(i).xh||'姓名:'
||yan_tab(i).xm||'工资:'||yan_tab(i).sal);
end loop;
close yan_cur;
end;
cursor yan_cur is select * from yanyan ;
type yan_table is table of yanyan%rowtype;
yan_tab yan_table;
begin
open yan_cur;
loop
fetch yan_cur bulk collect into yan_tab limit 2;
for i in 1..yan_tab.count loop
dbms_output.put_line('学号:'||yan_tab(i).xh||'姓名:'
||yan_tab(i).xm||'工资:'||yan_tab(i).sal);
end loop;
exit when yan_cur%notfound;
end loop;
close yan_cur;
end;