Follow us: Connect on YouTube Connect on YouTube Connect on YouTube

Pages

Sunday, 3 April 2016

Displaying Information from a PL/SQL Block

Use DBMS_OUTPUT.PUT_LINE.
DBMS_OUTPUT is a package PUT_LINE is a procedure within that package
Displays a message, value of a variable or both on to the screen
Example 1:
DBMS_OUTPUT.PUT_LINE(‘Hello! Welcome to PL/SQL’);
Example 2:
v_ename := ‘Amit’;
 -- where v_name is a local variable declared in the block
        DBMS_OUTPUT.PUT_LINE(‘Employee Name is :’ || v_ename);
Note: The DBMS_OUTPUT package must be enabled before using it by executing  SQL *Plus command SET SERVEROUTPUT ON
Share this article :

3 comments:

  1. Hello Dayakar,


    Thank you! Thank you! Thank you! Your blog was a total game changer!


    About six weeks ago, one of our Subscription databases was compromised as someone had performed a TRUNCATE TABLE on one of the replicated Tables. We managed to repair the damage be recreating the snapshot and reinitialising the Subscription, but no one owned up to carrying out the TRUNCATE.
    Does anyone know if it is possible to capture the following for any database and log it in a Table: -
    1. Date/Time
    2. Database Name
    3. SQL Command
    4. Host name
    5. Login Name
    I have looked at DDL Triggers but there is nothing there.

    It was cool to see your article pop up in my google search for the process yesterday. Great Guide.
    Keep up the good work!

    Shukran,
    Kim

    ReplyDelete
  2. Ni Hau,


    Such vivid info on theDisplaying Information from a PL/SQL Block! Flabbergasted! Thank you for making the read a smooth sail!


    I need to insert 10lakhs record using bulk collect. I got an error in say 96000th record how to solve it????? Using stored procedure and collections
    Kindly share the program if anyone knows.
    Great effort, I wish I saw it earlier. Would have saved my day :)


    Thanks a heaps,

    ReplyDelete
  3. Hello There,

    Zoooooooom! That’s how speedy and easy this read was! Looking forward to more of such powerful content on Displaying Information from a PL/SQL Block !

    I have data in a column
    #abcd#efghi#jlmn#opqrs

    I need to retrieve values between '#'. I need to get output as below

    var1 = abcd
    var2 = efghi
    var3 = jlmn
    var4 = opqrs

    Similary if column value is

    #abcd#efghi#jlmnopqrs

    var1 = abcd
    var2 = efghi
    var3 = jlmnopqrs
    var4 = null

    But nice Article Mate! Great Information! Keep up the good work!

    Thanks and Regards
    Preethi.

    ReplyDelete