解决方案 »

  1.   

    从搜索结果中看,需要用到游标,返回select结果集,需要这样吗?
      

  2.   

    需要用dbms_output.put_line打印出来,就算你用游标返回出来也不能像对表一样直接select,也需要打印。
    最好的方法是将结果存储在table中,然后对table进行select
      

  3.   

    因为存储过程中的select * from table不使用是毫无意义的。
    所以得用游标或者集合,以便后面数据的遍历使用。
      

  4.   

    我还是不明白,应该怎么把select * from table 从存储过程中输出。
      

  5.   


    create or replace procedure test is
    begin
      for c1 in (select 1 c1, 2 c2 from dual) loop
        dbms_output.put_line(c1.c1 || ' ' || c1.c2);
      end loop;
    end test;--调用
    set serveroutput on;
    begin
    test;
    end;
    /
      

  6.   


    create or replace procedure test is
    begin
      for c1 in (select 1 c1, 2 c2 from dual) loop
        dbms_output.put_line(c1.c1 || ' ' || c1.c2);
      end loop;
    end test;--调用
    set serveroutput on;
    begin
    test;
    end;
    /
    果然有一些复杂,也不知道为什么这样设定,先用再说,谢谢。