Вы находитесь на странице: 1из 13

PL/SQL is the procedural extension to SQL with design features of programming languages.

Data manipulation and query statements of SQL are include within procedural units of code. With PL/SQL , you can use SQL statements to finesse Oracle data, and PL/SQL control statements to process data.

PL/SQL engine PL/SQL Block PL/SQL block PL/SQL Procedural Statement executor

SQL

SQL statements executor Oracle server

PL/SQL Environment(CONT.....)
PL/SQL is a technology used by oracle server and by certain Oracle tools. Blocks of PL/SQL are passed to and processed by a PL/SQL engine , which may reside within the tool or within the Oracle server. When you submit PL/SQL blocks the PL/SQL engine in the Oracle server processes them. It separates the SQL statements and sends them individually to the SQL statements executor.

INTREGATION IMPROVED PERFORMANCE PORTABILITY MODULARITY OF PROGRAM DEVELOPMENT

Benefits of PL/SQL(CONT.)

IntegrationPL/SQL plays a central role in both the Oracle server(through stored procedures , stored functions , database triggers , and packages) and Oracle development tools(through oracle Development component triggers.).

SQL data types can also be used in PL/SQL. Combined with the direct access that SQL provides , these shared data types integrates PL/SQL with the Oracle server data dictionary. PL/SQL bridges the gap between convenient access to database technology and the need for procedural programming capabilities.

SQL

Application

SQL SQL

Other DBMs

SQL

Application

SQL IF.THEN SQL ELSE SQL END IF; SQL

Oracle with PL/SQL

Portability

DECLARE

BEGIN

EXCEPTION

END;

PL/SQL Block Structure


DECLARE(Optional)
Variables , cursors , user-defined exceptions

BEGIN(Mandatory)
- SQL statements - PL/SQL statements

EXCEPTION(Optional)
Actions to perform when errors occur END;(Mandatory)

Anonymous
[DECLARE]
BEGIN
-- statements

Procedure
PROCEDURE name Is BEGIN

Function
FUNCTION name RETURN datatype Is BEGIN --statements
[EXCEPTION]

-- statements
[EXCEPTION] END;

RETURN VALUE ;

[EXCEPTION]
END;

END;

Anonymous blocks are unnamed blocks. They are declared at point an application where they are to be executed and are passed to the PL/SQL engine for execution at run time. You can embed an anonymous block within a precomplier program and within iSQL*Plus.

Subprograms are named PL/SQL blocks that can accept parameters and can be invoked. You can declare the either as procedures or as functions. Generally use a procedure to perform an action and a function to compute a value.

NOTEA function is similar to procedure , except that a function must return a value.

Вам также может понравиться