Sie sind auf Seite 1von 14

INTRODUCTION TO PL/SQL

SCD2623 DATABASE PROGRAMMING Semester 2 2011/2012


1

INSPIRING CREATIVE AND INNOVATIVE MINDS

Learning Objective
After completing this lesson, you should be able to understand:
PL/SQL and application programming Application models

INSPIRING CREATIVE AND INNOVATIVE MINDS

Learning Objective
After completing this lesson, you should be able to understand (continued):
How to perform calculations with variables The use of SQL single-row functions in PL/SQL statements Decision structures: IF-THEN and CASE Looping actions SQL*Plus bind variables

About PL/SQL
PL/SQL:
Stands for Procedural Language extension to SQL Is Oracle Corporations standard data access language for relational databases Seamlessly integrates procedural constructs with SQL

About PL/SQL
PL/SQL:
Provides a block structure for executable units of code. Maintenance of code is made easier with such a well-defined structure. Provides procedural constructs such as:
Variables (stored values), constants, and data types Control structures such as conditional statements and loops Reusable program units that are written once and executed many times

PL/SQL Environment
PL/SQL engine procedural PL/SQL block SQL Procedural statement executor

SQL statement executor Oracle database server

Benefits of PL/SQL
Integration of procedural constructs with SQL Improved performance
SQL 1 SQL 2
SQL IF...THEN SQL ELSE SQL END IF; SQL

Benefits of PL/SQL
Modularized program development Integration with Oracle tools Portability Exception handling

Application Models
Three main components
User interface or screens Program logic (brains behind the screens) Database

Most models are based on a two- or three-tier structure

Two-tier Model
Commonly referred to as client/server Parts of the processing occur both on the users computer and the database server Named or stored program units are blocks of PL/SQL code saved in the Oracle database to provide server-side processing

Two-tier Diagram

Three-tier Model
Thin client with no code loaded on the user machine (browser access) Middle tier is the application server Forms server for Oracle Last tier is the database server Processing load is on the middle and last tier Maintenance is simplified

Three-tier Diagram

Oracle Documentation
Oracle Technology Network (OTN): otn.oracle.com Doc directory on CDs distributed by Oracle

Das könnte Ihnen auch gefallen