Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to show results from dbms_out.put_line while the procedure is running

gerhard2001Mar 30 2010 — edited Mar 31 2010
Hallo!

I created the following procedure:

create or replace procedure gerhard1 (n in number default 1) is
begin
dbms_output.put_line ('Initial time: ' || to_char(sysdate, 'HH:MI:SS'));
FOR i IN 1..3 LOOP
dbms_output.put_line ('('|| i ||'): ' || n);
dbms_lock.sleep(n);
END LOOP;
dbms_output.put_line ('Final time: ' || to_char(sysdate, 'HH:MI:SS'));
end;

And when I execute the procedure in SQLPLUS with:

SQL> execute gerhard1(3);

... I get after 9 seconds (the time, the procedure needs for executing) the following result:

Initial time: 04:12:42
(1): 3
(2): 3
(3): 3
Final time: 04:12:51

PL/SQL procedure successfully completed.

But SqlPLUS should show immediate:

Initial time: 04:12:42
(1): 3

Than after 3 seconds:

Initial time: 04:12:42
(1): 3
(2): 3

And after another 3 seconds:

Initial time: 04:12:42
(1): 3
(2): 3
(3): 3

And after another 3 seconds:

Initial time: 04:12:42
(1): 3
(2): 3
(3): 3
Final time: 04:12:51

PL/SQL procedure successfully completed.

What must I change/add inside of my code to realize it?

Please, can anybody help me?

Thanks a lot!

Gerhard
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2010
Added on Mar 30 2010
10 comments
3,960 views