不能这样执行,要向显示数据,直接使用select * from scott.emp

解决方案 »

  1.   

    这样就可以.SQL>SET SERVEROUTPUT ON
    SQL>
    CREATE OR REPLACE PROCEDURE prc_test
    IS
    nCount NUMBER(2);
    BEGIN
         dbms_output.put_line('Begin');
         SELECT COUNT(*) INTO nCount FROM TAB;     
         dbms_output.put_line(To_char(nCount));     
         dbms_output.put_line('End.');          
    END prc_test;
      

  2.   

    回复人: shahand(死磕) ( ) 信誉:100  2004-01-11 00:07:00  得分:0 
     
     
      不能这样执行,要向显示数据,直接使用select * from scott.emp===========================================================================
    (上几楼已经说了。)
      

  3.   

    存储过程不能返回表记录吗?sql server 可以啊!oracle没有临时表吗?
      

  4.   

    用 存储过程 返回数据集吧,可以呀,用游标方式。http://expert.csdn.net/Expert/topic/1999/1999981.xml?temp=.9081995临时表也有呀~ (用 DELPHI)
    http://expert.csdn.net/Expert/topic/2280/2280870.xml?temp=.7991297但在 SQLPLUS 里调用过程来显示数据集就不行.(要直接用 select..from... 的语句才行)
      

  5.   

    create package test_age
    as
    type mycursor is ref cursor;
    end;
    /
    create or replace procedure test(p_rc out test_age.mycursor)
    as
      s_emp varchar2(500);
    begin
    s_emp:='select * from scott.emp';
    open p_rc for s_emp;
    end test;
    /
    declare
    v_rc test_age.mycursor;
    begin
    test(v_rc);
    loop
    fetch v_rc into 变量,...;
    exit when v_rc%notfound;
    dbms_output.put_line(变量,...);
    end loop;
    end;
    /
      

  6.   

    有必要嗎?直接SELECT * FROM ......不就行了????
      

  7.   

    看来楼主把SQLPLUS里的操作和PL/SQL混为一谈了,多看看书吧