Database Reference
In-Depth Information
Operator : A character or phrase that the language uses to represent some particular arith-
metic, logical, or other function. Examples: +, -, AND, BETWEEN, :=.
Statement: A programmatic instruction to the computer to do something. Every statement
is composed of up to five main elements: literal values, keywords, programmersupplied
identifiers, operators, and a mandatory terminator. Some statements such as IF-THEN-
ELSE incorporate other statements inside them.
Terminator: A special character that you must put after each complete statement and each
declaration. In PL/SQL, the terminator is the semi-colon (;). The terminator announces
“okay, I'm through with this part.” It's important to realize that the terminator goes only at
the very end of the entire statement, and that the statement may span several lines in the
file.
Block: A sequence of code that includes executable statements and that is bounded by cer-
tain keywords. Virtually all PL/SQL programs incorporate one or more blocks, and every
block encloses one or more statements. Blocks can even be nested inside one another.
8.5 PL/SQL Input and Output
Most PL/SQL input and output (I/O) is through SQL statements that store data in database
tables or query those tables. All other PL/SQL I/O is done through APIs, such as the PL/
SQL package DBMS_OUTPUT.
DBMS_OUTPUT: Is a collection of procedure and functions, used to collect data in a sys-
tem buffer. This data can be retrieve later on. The DBMS_OUTPUT package enables us to
send messages from stored procedures, packages, and triggers.
PUT_LINE: PUT_LINE procedures in this package enable a user to place information in a
buffer that can be read by another trigger, procedure, or package.
Writing first PL/SQL Program
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello Everybody');
END;
This is called an anonymous block, a block with no name. only one statement is execut-
abled by calling a procedure PUT_LINE, supplied in Oracle's built-in package named
DBMS_OUTPUT. PUT_LINE is used to print message or data.
Entering PL/SQL Statements into SQL*Plus
SQL> BEGIN
2 DBMS_OUTPUT.PUT_LINE('Hello Everybody');
3 END;
Search WWH ::




Custom Search