You are on page 1of 14

Programming in PL/SQL

Module 3

Introduction
SQL is a great query language, but it has its limitations. Oracle added a procedural language extension to SQL known as Programming Language Extensions to SQL(PL/SQL). SQL statements are used to retrieve data and PL/SQL control statements are used to process data in a PL/SQL program. The Oracle server has an engine to execute SQL statements. The SQL statements are sent one at a time to the server for execution, which results in individual calls to the server for each SQL statement. All SQL statements within a single PL/SQL block are sent in a single call to the server, which reduces overhead and improves performance.

A PL/SQL program consists of statements. Not case sensitive except for character string values enclosed in single quotes Consists of reserved words, identifiers, delimiters, literals and comments. Reserved Words Words provided by the language that have a specific use in the language. Eg: DECLARE, BEGIN, END, IF, WHILE, EXCEPTION, PROCEDURE, FUNCTION, PACKAGE, TRIGGER

User Defined Identifiers


Use to name variables, constants, procedures, functions, cursors, tables, records and exceptions. Rules in naming identifiers
The name can be from 1 to 30 characters in length The name must start with a letter Letters(A-Za-z), numbers, the dollar sign($), the number sign(#) and the underscore(_) are allowed. Spaces are not allowed Other special characters are not allowed. Keywords cannot be used as user defined identifiers. Names must be unique within a block A name should not be the same as the name.

You might also like