Wednesday, October 15, 2014

DISPLAYING USER MESSAGES ON THE VDU SCREEN



Programming tools require a method through which messages can be displayed on the VDU screen.

DBMS_OUTPUT is a package that includes a number of procedures and functions that accumulate information in a buffer so that it can be retrieved later. These functions can also be used to display messages.
PUT_LINE puts, a piece of information in the package buffer followed by an end-of-line marker. It can also be used to display a message. PUT_LINE expects a single parameter of character data type. If used to display a message, it is the message string.

To display messages, the SERVEROUTPUT should be set to ON. SERVEROUTPUT is a SQL *PLUS environment parameter that displays the information passed as a parameter to the PUT_LINE function.

Syntax:
SET SERVEROUTPUT [ON/OFF]

Comments
A comment can have two forms, as:
Ø  The comment line begins with a double hyphen (--). The entire line will be treated as a comment.
Ø  The comment line begins with a slash followed by an asterisk (/*) till the occurrence of an asterisk followed by a slash (*/). All lines within are treated as comments. This form of specifying comments can be used to span across multiple lines. This technique can also be used to enclose a section of a PL/SQL block that temporarily needs to be isolated and ignored.

No comments: