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
Parameter Default Values As the illustration below shows, you can initialize the IN parameters to the default values. In that way, you can pass various numbers of actual par

Procedures   The procedure is a subprogram which performs a specific action. You write procedures using the syntax as shown below: PROCEDURE name [(parameter[, parameter, .

Object Types An object type is a user-defined complex datatype which encapsulates the data structure along with the functions and procedures required to manipulate the data. Th

Referencing Records Unlike the elements in a collection, that are accessed using subscripts, the fields in a record are accessed by name. To reference an individual field, you

Magento change address format depending on store Project Description: What I need is that depending on the store in which the customer bought the address should change the fo

BETWEEN and NOT BETWEEN Operator in SQL Example: Restricting exam marks to between 0 and 100 CREATE ASSERTION Marks_between_0_and_100 CHECK (NOT EXISTS (SELECT * FROM

Pass the nulls to a dynamic SQL: Passing Nulls: Assume that you want to pass the nulls to a dynamic SQL statement. For illustration, you may write the EXECUTE IMMEDIATE

Effects of NULL Operator As a general rule-but not a universal one-if NULL is an argument to an invocation of a system-defined read-only operator, then NULL is the result of t

Effects of NULL for UNIQUE Specification When a UNIQUE specification u for base table t includes a column c that is not subject to a NOT NULL constraint, the appearance of sev

EXIT The EXIT statement forces a loop to done unconditionally. Whenever an EXIT statement is encountered, the loop is done immediately and controls the passes to the next statem