procedural_sql_1 - Procedural SQL Part 1: Introduction to...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Procedural SQL Part 1: Introduction to PL/SQL to Sequential
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Intro to PL/SQL PL/SQL (Procedural Language/Structured Query Language) is Oracle’s proprietary procedural extension to SQL. The key strength of PL/SQL is its tight integration with the Oracle database. All PL/SQL programs are made up of blocks and PL/SQL can use conditional statements, loops and branches to control program flow. Scope of the variables can be defined to restrict the visibility within the block.
Background image of page 2
Purpose PL/SQL is a combination of SQL along with the procedural features of programming languages. It was developed by Oracle Corporation in the early 90’s to enhance the capabilities of SQL. It offers language constructs similar to those in imperative programming languages and allows users and designers to develop complex database applications that require the usage of control structures and procedural elements such as procedures, functions, and modules.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Purpose (cont.) In summary, the major goals of PL/SQL are to increase the expressiveness of SQL, process query results in a tuple-oriented way, optimize combined SQL statements, develop modular database application programs, reuse program code, and reduce the cost for maintaining and changing applications.
Background image of page 4
Advantages of PL/SQL Block Structures : PL/SQL consists of blocks of code, which can be nested within each other. Each block forms a unit of a task or a logical module. PL/SQL Blocks can be stored in the database and reused. Procedural Language Capability : PL/SQL consists of procedural language construacts such as conditional statements (if else statements) and loops like (FOR loops). Better Performance : PL/SQL engine processes multiple SQL statements simultaneously as a single block, thereby reducing network traffic. Error Handling : PL/SQL handles errors or exceptions effectively during the execution of a PL/SQL program. Once an exception is caught, specific actions can be taken depending upon the type of the exception or it can be displayed to the user with a message.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The PL/SQL Block The basic construct in PL/SQL is a block . Blocks allow designers to combine logically related (SQL) statements into units. In a block, constants and variables can be declared, and variables can be used to store query results. Statements in a block include: SQL statements, control structures (loops), condition statements (if-then-else), exception handling, and calls to other PL/SQL blocks.
Background image of page 6
[<Block header>] [DECLARE <Constants> <Variables> <Cursors> <User defined exceptions>] BEGIN <PL/SQL statements> [EXCEPTION <Exception handling>] END;
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 35

procedural_sql_1 - Procedural SQL Part 1: Introduction to...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online