在Oracle 中,存储过程调用游标的sql语句,怎么写 ?谢谢!

解决方案 »

  1.   

    先定义
    define cursor然后open cursor然后一般是循环fetch cursor最后close cursor
      

  2.   

    create or replace procedure p_name
    as 
    cursor cursor_name is
     .........;
    begin
    open cursor_name;
    loop
    fetch....
    exit 
    when cursor_name%notfound
    .......;
    end loop;
    close cursor_name;
    end;或者是用游标变量create or replace procedure p_name(v_c in out sys_refcursor)
    is
    begin
     open v_c for
     select .......;
    .................;
    end;