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
Using RENAME in combination with JOIN - SQL Example gives pairs of ids of students having the same name, by joining two renamings of IS_CALLED. Example gives an equivalent ex

Seeking a programmer to design a legal document with pre-existing fields that could allow the auto-population of client(s) information (i.e. Name, Account Number, Address etc.) int

Updating a Variable Assignment of an attribute value in a variable of a structured type Synatx: SET SN.C = 'S2'; As in Example the entire statement is equivalent to a

Parameter Modes   To define the behavior of formal parameters you use the parameter modes. The 3 parameter modes, IN, OUT, & IN OUT, can be used with any subprogram. Though, a

%NOTFOUND The %NOTFOUND is logical, opposite of the %FOUND. The %NOTFOUND yields FALSE if the last fetch returned a row, or TRUE when the final fetch failed to return a row. I

Closing a Cursor Variable The CLOSE statement disables the cursor variable. After that, the related result set is undefined. The syntax for the same is as shown below: CLOS

Number Types The Number types permit you to store the numeric data (real numbers, integers, and floating-point numbers), show quantities, and do computations. BINARY_INTEG

Consider the following set of database tables (same tables from Assignment 6-1). Please take note of foreign keys (most of them carry the same names as the corresponding primary ke

heap sort program in pl/sql

Explicitly specifying the join condition - SQL SELECT * FROM IS_CALLED JOIN IS_ENROLLED_ON ON ( IS_CALLED.StudentId = IS_ENROLLED_ON.StudentId ) Now, the key word JO