Oracle Equivalent of Print in SQL Server

Posted on 2004-11-24
Last Modified: 2008-01-09

I'm new to Oracle.Im now converting SQL stored procedure to Oracle stored procedure.As in my Sql Stored procedure, i have those print 'record inserted into xxx table' to show whether the records successfully inserted to different table.Is there anyway i can do the same in Oracle in order to track what has the stored procedures done?

Question by:sinwee80
    LVL 9

    Expert Comment

    dbms_output.put_line(YOUR variables)

    you will need to SET SERVEROUTPUT ON before the above line will display the results in SQL Plus window
    LVL 7

    Expert Comment

    Actually, in a script, you need to use CALL, only in PL/SQL it works without.
    Also, the function requires one parameter; you can use it like this:

    CALL DBMS_OUTPUT.PUT_LINE('Value :' || TO_CHAR(value));
    CALL DBMS_OUTPUT.PUT('Value: ');

    DBMS_OUTPUT has a limit on how many characters you can output, so you will probably like to add the following statement after the SET SERVEROUTPUT :


    Author Comment

    If i have a db program which execute this stored procedure, Can this dbms_output.put_line(YOUR variables)
    captured in the vb program to log to a file?
    LVL 7

    Accepted Solution

    You best look first at the documentation:

    As you see there, DBMS_OUTPUT actually writes to a buffer.
    With DBMS_OUTPUT.GET_LINE or DBMS_OUTPUT.GET_LINES you can retrieve the contents of that buffer in your program.

    Alternatively, you could use supplied package UTL_FILE to write to a file:

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
    Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
    This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
    This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now