Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: DBMS_OUTPUT.PUT_LINE doesn't work

Re: DBMS_OUTPUT.PUT_LINE doesn't work

From: Jurij Modic <jmodic_at_src.si>
Date: 1998/10/24
Message-ID: <363214bc.5673155@news.siol.net>#1/1

On Sat, 24 Oct 1998 19:38:14 +0200, vagelis Hristidis <exrist_at_cc.ece.ntua.gr> wrote:

>I try to have some text printed in sqlplus.
>I type:
>
>exec DBMS_OUTPUT.enable;
>exec DBMS_OUTPUT.PUT_LINE('hallo');
> I get the answer "PL/SQL procedure successfully completed."
> for both commnads but nothing is printed.
>What's wrong?

The procedure DBMS_OUTPUT.ENABLE only enables the calls to DBMS_OUTPUT procedures. If the ENABLE procedure is not in force then the calls to other DBMS_OUTPUT procedures are simply ignored.

When ENABLE is in force, it simply means the output of calls to PUT and PUT_LINE are buffered. The contents of a buffer will *not* be printed to the output symply by ENABLEing the package! If you want to display the contents of a DBMS_OUTPUT buffer you have to call DBMS_OUTPUT.GET_LINE or GET_LINES procedure!

Hovewer, ServerManager (svrmgr, svrmgrl,...) and Sql*Plus can make this GET_LINE calls for you automaticaly after any insert, update, delete and anonymous plsql blocks if you enable this with the command "SET SERVEROUTPUT ON". Here are examples of both methods (manual and automatic output) using sqlplus:

SQL> variable x varchar2(100)
SQL> variable y number
SQL> REM serveroutput is off, we'll display output manualy!
SQL> EXEC dbms_output.ENABLE;

PL/SQL procedure successfully completed.

SQL> EXEC dbms_output.PUT_LINE('First line');

PL/SQL procedure successfully completed.

SQL> EXEC dbms_output.PUT_LINE('Second line');

PL/SQL procedure successfully completed.

SQL> EXEC dbms_output.GET_LINE(:x, :y);

PL/SQL procedure successfully completed.

SQL> PRINT x

X



First line

SQL> EXEC dbms_output.GET_LINE(:x, :y);

PL/SQL procedure successfully completed.

SQL> PRINT x

X



Second line
SQL> REM Now we'll enable automatic calls to GET_LINE
SQL> SET SERVEROUTPUT ON
SQL> EXEC dbms_output.put_line('First line');
First line

PL/SQL procedure successfully completed.

SQL> EXEC dbms_output.put_line('Second line'); Second line

PL/SQL procedure successfully completed.

>Thanks in advance
>--
>Vagelis S. Hristidis
>Electrical and Computer Engineering
>National Technical University of Athens
>e-mail:exrist_at_cc.ece.ntua.gr
>URL:http://www.cc.ece.ntua.gr/~exrist

HTH,
Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Sat Oct 24 1998 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US