Package dbms output in pl/sql, PL-SQL Programming

DBMS_OUTPUT:

The Package DBMS_OUTPUT enables you to display output from the PL/SQL subprograms and blocks, that makes it easier to test and debug them. The procedure put_ line results the information to the buffer in the SGA. You can display the information by calling the procedure get_line or by setting the SERVEROUTPUT ON in the SQL*Plus. For illustration, assume that you create the stored procedure which is as shown below:

CREATE PROCEDURE calc_payroll (payroll OUT NUMBER) AS

CURSOR c1 IS SELECT sal, comm FROM emp;

BEGIN

payroll := 0;

FOR c1rec IN c1 LOOP

c1rec.comm := NVL(c1rec.comm, 0);

payroll := payroll + c1rec.sal + c1rec.comm;

END LOOP;

/* Display debug info. */

DBMS_OUTPUT.PUT_LINE('Value of payroll: ' || TO_CHAR(payroll));

END;

Whenever you issue the commands below, the SQL*Plus display the value assigned by the procedure to the parameter payroll:

SQL> SET SERVEROUTPUT ON

SQL> VARIABLE num NUMBER

SQL> CALL calc_payroll(:num);

Value of payroll: 31225

Posted Date: 10/6/2012 7:46:15 AM | Location : United States







Related Discussions:- Package dbms output in pl/sql, Assignment Help, Ask Question on Package dbms output in pl/sql, Get Answer, Expert's Help, Package dbms output in pl/sql Discussions

Write discussion on Package dbms output in pl/sql
Your posts are moderated
Related Questions
Forward Declarations The PL/SQL needs that you declare an identifier before using it. And hence, you should declare a subprogram before calling it. For illustration, the decla

Structure of an Object Type: Similar to package, an object type has 2 parts: the specification and the body. The specification is the interface to your applications; it declar

Mixed Notation The fourth procedure call shows that you can mix the positional and named notation. In this situation, the first parameter uses the positional notation, & the s

Subprograms The PL/SQL has two types of subprograms known as the procedures and functions that can take parameters and be invoked. As the following example represents, a subp

Name Resolution   During the compilation, the PL/SQL compiler relates identifiers like the name of a variable with an address or memory location, actual value, or datatype. Th

3CX PBX sync Windows Service Project Description: !! You require access to a commercial version of the 3CX PBX system in order to be able to program the API !! !! You requ

Projection and Existential Quantification - SQL Intuitively it might seem that projection in SQL is simply a matter of specifying the required columns in the SELECT clause, a

Parameter and Keyword Description:   table_reference: This identifies a table or view which should be available when you execute the INSERT statement, and for that you sho

Parameter Aliasing   To optimize the subprogram call, the PL/SQL compiler can decide between the two techniques of the parameter passing. With the by-value techniques, the v

DELETE Command - SQL Loosely speaking, DELETE removes some existing rows from its target table. Suppose the university decides that course C3 is to be withdrawn. Example shows