解决方案 »

  1.   

    举例:--创建procedure
    create or replace procedure sql_test(out_return out sys_refcursor) is
    begin
      open out_return for 'select * from tgp_funds';
    end;--引用declare
      cur1   SYS_REFCURSOR;
      i      tgp_funds%rowtype;
    begin
     sql_test(cur1);
      loop
        fetch cur1
          into i;
        exit when cur1%notfound;
        dbms_output.put_line('----------------:' || i.fnd_id);--fnd_id为表tgp_funds中的fnd_id 列
      end loop;
      close cur1;
    end;
      

  2.   

    举例:--创建procedure
    create or replace procedure sql_test(out_return out sys_refcursor) is
    begin
      open out_return for 'select * from tgp_funds';
    end;--引用declare
      cur1   SYS_REFCURSOR;
      i      tgp_funds%rowtype;
    begin
     sql_test(cur1);
      loop
        fetch cur1
          into i;
        exit when cur1%notfound;
        dbms_output.put_line('----------------:' || i.fnd_id);--fnd_id为表tgp_funds中的fnd_id 列
      end loop;
      close cur1;
    end;
    正解++
      

  3.   


    按照你的代码查询的结果还是在输出里面显示的呀。
    我想要的结果是 执行存储过程显示的结果在SQL里面的。是像这样的结果。  能实现吗?
      

  4.   

    你可以将你的SQL通过建立视图保存起来,以后每次查询直接查询视图,这样能够达到你想要的效果。也可以避免你每次去重复的编写复杂的SQL
      

  5.   

    好吧,貌似也只能这样了。  TKS!