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

No comments:

Post a Comment