Debugging statement

0
Debugging statement:
  • The debugging statement of  PL/SQL is DBMS_OUTPUT.PUT_LINE();
  • For producing outputs on the video device we need the assistance of DBMS_OUTPUT Package.
  • The procedure PUT_LINE() outputs information to a buffer in the SGA.
  • This procedures is used to identify the error during runtime of the PL/SQL block.
  • This procedure requires a single parameter of any of the data types varchar2 or number or data.
  • To see the output of PUT_LINE() on the console of the client side enter the following SQL plus command on the SQL prompt.

Syntax:
DBMS_OUTPUT.PUT_LINE(‘Message’||’variablename);

  • The DBMS_OUTPUT packages is owned by the oracle user SYS.
  • The size of the buffer can be set between 2000 to 10,00,000 bytes.
  • The specification to set buffers are
            1) SET SERVEROUTPUT ON
            2) SET SERVEROUTPUT ON SIZE 4000
            3) SET SERVEROUTPUT OFF
SQL>BEGIN
   
        DBMS_OUTPUT.ENABLE;
   
        DBMS_OUTPUT.PUT_LINE(‘First program in PL/SQL’);
   
        DBMS_OUTPUT.PUT_LINE(‘Illustrating by’);
   
        DBMS_OUTPUT.PUT_LINE(‘‘‘net lo java’’’);
   
    END;
  • DBMS_OUTPUT.ENABLE;  Once declare will make the SERVEROUTPUT  process to get activated.

SQL>DECLARE
   
        V_FirstNum NUMBER:=&fno;
   
        V_SecondNum NUMBE:=&sno;
   
        V_tol NUMBER;
   
     BEGIN
   
        V_tol:=v_FirstNum+v_SecondNum;
   
        DBMS_OUTPUT.PUT_LINE(‘The sum of  Frist and second num is ‘||v_tol);
   
    END;


SQL>BEGIN
   
        DBMS_OUTPUT.PUT_LINE(‘The sum of  first and second num is ‘||(&FirstNum+&secondNum));
   
     END;

 Click here to go to Back page

About the author

Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus. Aenean fermentum, eget tincidunt.

0 comments:

Recent Posts