示例如下:
create or replace package MyPackage as 
  type ReCursor is ref cursor;
end MyPackage;create or replace procedure MyPro (outcur out Mypackage.ReCursor) is
begin
  open outcur for 
    select * from table_test where id<=3;
end;我想直接在sqlplus命令行中查看结果(不是从外部程序调用),就是:
SQL>该怎么写?这个报错:
declare aa MyPackage.ReCursor%rowtype;
begin
  exec aa := Mypro;
end;刚接触Oracle,请大家指教

解决方案 »

  1.   

    补充:上面写错了:
    declare aa MyPackage.ReCursor%rowtype;
    begin
      exec Mypro(aa);
    end;
    这个报错
      

  2.   

    http://topic.csdn.net/u/20100319/08/525e6be7-7357-4b72-9fd2-90cb9531a910.html
      

  3.   

    这个帖子中你说如果在pl/sql Developer中的话就要用put_line 逐条打出来,但是要执行的话是怎么样执行呢?就是怎么声明一个变量,然后把它传给存储过程?
      

  4.   

    create or replace procedure sp_fetchdata(cur_out out sys_cursor) is
    begin
    open cur_out for 'select * from emp';
    end;
    /
    然后在plsql中:
    SQL> var results refcursorSQL> exec sp_fetchdata(results);SQL> print results;
      

  5.   

    var aa  refcursor;
    begin
      exec Mypro(aa);
    end;
    --打印过程中out参数的内容
    print aa;
      

  6.   

    嗯,谢谢,我的意思是:在sqlplus命令行中是这样“var aa refcursor”,能打印出结果,但是在pl/sql Developer工具中要怎么样才能看到结果?在pl/sql Developer中的命令窗口中“var sresult refcursor;”报错
      

  7.   

    在sqldeveloper中没有用过,我一般都是在sqlplus中使用!
      

  8.   

    var sresult refcursor;--语句不能够在sqldeveloper中执行!