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
Manipulating Collections Within PL/SQL, the collections add procedural power and flexibility. The biggest benefit is that your program can compute subscripts to process the spec

Anatomy of a Table: Figure shows the terminology used in SQL to refer to parts of the structure of a table. As you can see, SQL has no official terms for its counterpa

At times, Brewbean's has changed the id number for existing products. In the past, they have had to add a new product row with the new id to the BB_PRODUCT table, modify all the co

Relational Operators and Logical Operators It prepares the ground for subsequent sections in which each specific relational operator is paired with its logical counterpart, su

Using COMMIT The COMMIT statements end the present transaction and make permanent any changes made during that transaction. Till you commit the changes, other users cannot acc

Example of Foreign Key Constraint Example: Alternative formulation for 6.3 as a foreign key constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Must_be_enrolled_to_take_exam

LEVEL You use the LEVEL with the SELECT CONNECT BY statement to categorize rows from a database table into a tree structure. The LEVEL returns the level number of a node in a

Loop Labels Like the PL/SQL blocks, loops can also be labeled. The label, an undeclared identifier enclosed by double angle brackets, should appear at the beginning of the LOOP

Semidifference and NOT - SQL In this section first describe the relational difference operator, named MINUS. Example here shows SQL's closest counterpart of that operator.

Collections:   The collection is an ordered group of elements, all of similar type (for illustration, the grades for a class of students). Each element has an exclusive subsc