oracle 游标取值回顾

create or replace procedure testP is

  a varchar2(100);

  b varchar2(100);

  n_count number;

  TYPE MY_CUR IS REF CURSOR;

  c_count my_cur;

begin

  n_count := 0;

  open c_count for select scott.emp.ename , scott.emp.job from scott.emp where empno like '7%';

  fetch c_count into a,b;

  --while c_count%Found

  loop 

    exit when c_count%notfound;

    

    n_count:=n_count+1;

    dbms_output.put_line(n_count||'   a=='||a||'   b=='||b);

    fetch c_count into a,b;

    

  end loop;

  close c_count;

end testP;

猜你喜欢

转载自gaoke.iteye.com/blog/2028577