PL/SQL

PL/SQL page 1 PL/SQL page 2

This section will provide a basic understanding of PL/SQL. … PL/SQL and provide brief examples illustrating the important facets of the language. …

More PDF Content

PL/SQL
Page 1
1 PL/SQL This section will provide a basic understanding of PL/SQL. This document will briefly cover the main concepts behind PL/SQL and provide brief examples illustrating the important facets of the language. Most of the information contained in this section is DIRECTLY extracted from “PL/SQL User’s Guide and Reference” and all credit should be given to ORACLE. If you require more detailed information than provided in this section, consult the above stated manual. PL/SQL is Oracle’s procedural language extension to SQL, the relational database language. PL/SQL fully integrates modern software engineering features such as data encapsulation, information hiding, overloading, and exception handling, and so brings state-of-the-art programming to the ORACLE Server and a variety of ORACLE tools. Overview of PL/SQL With PL/SQL, you can use SQL statements to manipulate ORACLE data and flow-of-control statements to process the data. Moreover, you can declare constants and variables, define subprograms (procedures and functions), and trap runtime errors. Thus, PL/SQL combines the data manipulating power of SQL with the data processing power of procedural languages. PL/SQL is a block-structured language. That is, the basic units (procedures, functions, and anonymous blocks) that make up a PL/SQL program are logical blocks, which can contain any number of nested sub-blocks. Typically, each logical block corresponds to a problem or subproblem to be solved. A block (or sub-block) lets you group logically related declarations and statements. That way you can place declarations close to where they are used. The declarations are local to the block and cease to exist when the block completes. [DECLARE -- declarations] BEGIN — statements [EXCEPTION -- handlers] END; FUNDAMENTALS of PL/SQL Lexical Units PL/SQL is not case-sensitive, so lower-case letters are equivalent to corresponding upper-case letters except within string and character literals. A line of PL/SQL text contains groups of characters known as lexical units, which can be classified as follows: •delimiters (simple and compound symbols) •identifiers, which include reserved words •literals •comments
Page 2
2 A delimiter is a simple or compound symbol that has a special meaning to PL/SQL. For example, you use delimiters to represent arithmetic operations such as addition and subtraction. You use identifiers to name PL/SQL program objects and units, which include constants, variables, exceptions, cursors, subprograms, and packages. Some identifiers called RESERVED WORDS, have a special syntactic meaning to PL/SQL and so cannot be redefined. For flexibility, PL/SQL lets you enclose identifiers within double quotes. Quoted identifiers are seldom needed, but occasionally they can be useful. A literal is an explicit numeric, character, string, or Boolean value not represented by an identifier. •Two kinds of numeric literals can be used in arithmetic expressions: integers and reals. •String literal is a sequence of zero or more characters enclosed by single quotes. All string literals except the null string (`’) belong to type CHAR. PL/SQL is case-sensitive within string literals. •Boolean literals are the predefined values TRUE and FALSE and the non-value NULL (which stands for a missing, unknown, or inapplicable value). Keep in mind that Boolean literals are not strings. The PL/<

Processing your request, Please wait....

Download PDF eBook

PDF | Source » users.iit.uni-miskolc.hu | 35 pages | 84.43 KB |

Leave a Reply