这个我当然也知道,但是我的难题是如何将结果输出。
我看到有个贴子说了输出到文件的办法,但是我在添加
SS :=UTL_FILE.OPEN('/TMP','WWW.TXT','W');的时候,提示我不能识别open。
当然最直接的就是输出到屏幕了。
请教各位了,我急啊!

解决方案 »

  1.   

    report.sql:
    set serveroutput on;
    spoo d;\result.txt;
    begin
    declare starttime date:=sysdate;endtime date;
    begin
    {call yourproc};
    endtime:=sysdate;
    dbms_output.put_line('starttime:'||to_char(starttime));
    dbms_output.put_line('endtime:'||to_char(endtime));
    end;
    end;
    /
    spoo off;
      

  2.   

    用text-io这个package可以忘文件中写数据
    declare
      out_file text_io.file_type;
      v_str varchar2(2000);
    begin
       v_str := 'dfggfgf';
       out_file:=text_io.fopen('c:\text.txt','w');
       text_io.put_line(out_file,v_str);
       text_io.fclose(out_file);
    end;
      

  3.   

    guo: 谢了,输出到屏幕上我明白了。
    你的spoo是作何用途的(因为我在sql worksheet中执行时无法识别)。
    还有,我如何输出到文件里呢?
      

  4.   

    Fxx:
    我运行后提示:
    identifier 'TEXT_IO.FILE_TYPE' must be declared
    是否我还有什么字典没执行?谢谢。