Vishal
Vishal

Reputation: 279

PL SQL output is not getting displayed

I have fairly simply code ..running in Oracle Virtualbox. However for some reason it is not displaying pl/sql output.

Here is code snippet

SQL> set serveroutput on
SQL> list
    1   Create or Replace procedure mytz
    2       IS
    3       v_mytz TIMESTAMP WITH TIME ZONE DEFAULT '2013-05-05 12:00:00 AM';
    4       BEGIN
    5       DBMS_OUTPUT.PUT_LINE ('Default timestamp is ' );
    6*     end mytz ;
SQL> /

     Procedure created.

 SQL> 

Is there anything I need to do special to see the output on SQL prompt ?

Upvotes: 0

Views: 8644

Answers (1)

Alex Poole
Alex Poole

Reputation: 191245

You have to actually run the procedure, not just create it, e.g.:

set serverputput on
exec mytz;

The set serveroutput SQL*Plus command has to be in the session the procedure is executed, not the one where it is created (if they are different).

You are not showing the value of your variable at the moment; maybe you wanted this?

    dbms_output.put_line('Default timestamp is: ' || v_mytz);

Upvotes: 1

Related Questions