0

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 ?

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. That was it. ps: I had purposely had not added v_mytz. Now I am getting output from this and other procs also.
@Vishal - I should also have pointed out that you're using implicit format models for your conversions. You should be using to_timestamp for the assignment and to_char for display, using explicit format models; otherwise it will behave differently and might error in sessions with different NLS settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.