declare
type c1 is ref cursor;
emp_cursor c1;
v_ename emp.ename%type;
v_sal emp.sal%type;
begin
open emp_cursor for
select ename,sal from emp where deptno=10;
loop
fecth emp_cursor into v_ename,v_sal;
exit when emp_cursor%notfound;
dbms_output.put_line(v_ename);
end loop;
close emp_cursor;
end;
/
type c1 is ref cursor;
emp_cursor c1;
v_ename emp.ename%type;
v_sal emp.sal%type;
begin
open emp_cursor for
select ename,sal from emp where deptno=10;
loop
fecth emp_cursor into v_ename,v_sal;
exit when emp_cursor%notfound;
dbms_output.put_line(v_ename);
end loop;
close emp_cursor;
end;
/
dbms_output.put_line(v_ename); 产生的output长度问题吗?
cursor u_cursor_item is select 1 from dual;
begin
open u_cursor_item;
loop
fetch u_cursor_item into v_aaa;
exit when u_cursor_item%notfound;
/*主题*/
end loop ;
close u_cursor_item;
ORA-06550: 第 10 行, 第 19 列:
PLS-00103: 出现符号 "EMP_CURSOR"在需要下列之一时:
:= . ( @ % ;
ORA-06550: 第 10 行, 第 48 列:
PLS-00103: 出现符号 ";"在需要下列之一时:
. ( , % from
ORA-06550: 第 14 行, 第 9 列:
PLS-00103: 出现符号 "CLOSE"在需要下列之一时:
end not pragma final
instantiable order overriding static member constructor ma
ORA-06550: 第 16 行, 第 6 列:
PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
begin function
package pragma procedure subtype type use <an identifier>
<a double-quoted delimited-identifier> form current cursor
结帖率:0.00% begin
open emp_cursor for
select ename,sal from emp where deptno=10;
loop
fecth emp_cursor into v_ename,v_sal;
exit when emp_cursor%notfound;
dbms_output.put_line(v_ename);
end loop;
close emp_cursor;
end;
/
仔细看看所有的红色部分。fecth应为fetch另外,期待打破0记录,呵呵。。
使用工具,如PL/SQL。并开启其提示功能,事半功倍!