Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: dbms_output in a PL/SQL loop...
In article <3e292f2f$1_at_news.swissonline.ch>, "Gilles says...
>
>Hi,
>I have been trying to put a dbms_outoput.put_line in a PL/SQL Loop to get a
>"real time" print of where the loop actually is working, but it seem that
>all the output records print on the screen only when the loop is finished...
>
>Does anybody know how to get a "real time advance indicator" for a PL/SQL
>loop ?
>
>Thanks in advance for your help...
>
>Gilles
>
>
In addition to dbms_application_info and utl_file -- both of which work great, you can use a pipelined function in 9i:
ops$tkyte_at_ORA920> create or replace type msgType as table of varchar2(80) 2 /
Type created.
ops$tkyte_at_ORA920>
ops$tkyte_at_ORA920> create or replace function foo return msgType
2 PIPELINED
3 as
4 begin
5 pipe row( 'start ' || systimestamp ); 6 for i in 1 .. 10 7 loop 8 pipe row( 'iteration ' || i || ' ' || systimestamp ); 9 dbms_lock.sleep( 1 ); 10 pipe row( 'done iteration ' || i ); 11 end loop; 12 return;
Function created.
ops$tkyte_at_ORA920> ops$tkyte_at_ORA920> set arraysize 1 ops$tkyte_at_ORA920> select * from TABLE(foo);
COLUMN_VALUE
21 rows selected.
You cannot see it here but the data was fed back to the sqlplus client as it was produced....
-- Thomas Kyte (tkyte@oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Sat Jan 18 2003 - 16:18:13 CST