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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to spool DBMS_OUTPUT.PUT_LINE from SqlPlus?

485654Feb 4 2009 — edited Feb 4 2009
Hi,

i have a stored procedure test:
procedure test is
begin
dbms_output.put_line('Test');
dbms_output.put_line('Test2');
dbms_output.put_line('Test3');
dbms_output.put_line('Test4');
dbms_output.put_line('Test5');
end;

I start the stored procedure out of sqlplus:
spool C:\Temp\test.spl;
exec test;
commit;
spool off;
exit;

My problem is no Test or Test2 appeared in the spool file.
What should i do?

thanks a lot
This post has been answered by 21205 on Feb 4 2009
Jump to Answer

Comments

21205
...why the commit?...
set serveroutput on
before you start the spool
576633
create or replace procedure hmm as
begin
dbms_output.put_line('Test1');
dbms_output.put_line('Test2');
dbms_output.put_line('Test3');
dbms_output.put_line('Test4');
dbms_output.put_line('Test5');
end;

spool C:\Temp\test.spl;
exec hmm;
spool off;
File content is:

Test1
Test2
Test3
Test4
Test5
PL/SQL procedure successfully completed.
21205
Answer
...but you probably have your serveroutput turned on? Maybe in your login script?
show serveroutput
Marked as Answer by 485654 · Sep 27 2020
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 4 2009
Added on Feb 4 2009
3 comments
56,276 views