我这样写一个简单的过程:
create or replace procedure query_by_deptno(v_deptno emp.deptno%type) is
  v_empno emp.empno%type;
  v_ename emp.ename%type;  cursor c_cursor is
    select empno, ename from emp where deptno = v_deptno;begin
  open c_cursor;
  loop
    fetch c_cursor
      into v_empno, v_ename;
    exit when c_cursor%notfound;
    dbms_output.put_line(v_empno || '   ' || v_ename);
    and loop;    close c_cursor;
  end;
编译时显示在end loop;那里报错了

解决方案 »

  1.   

    and loop; 
    改为
    end loop; 
      

  2.   

    呵呵,谢谢,我再问下你:sys_refcursor是游标的一种类型,那refcursor也是游标的一种类型吧?
    比如定义游标:
     type t_cursor is ref cursor; --申明一个游标t_cursor,它是ref cursor型的
     cur_cursor t_cursor; --cur_cursor是游标t_cursor的一个实例变量
    ----------------------------------------------------------------------
    还有这种定义游标的:
     emp_refcur   sys_refcursor; --emp_refcur是sys_refcursor游标的一个实例变量请兄弟仔细看一下,我这样理解正确不?--注释是我的理解