24-11-2012, 05:30 PM
PL/SQL
PLSQL final.pptx (Size: 319.33 KB / Downloads: 28)
What is PL/SQL?
PL/SQL stands for Procedural Language/SQL.
It extends SQL by adding constructs found in procedural languages, resulting in a structural language that is more powerful than SQL.
It supports variables, conditions, arrays and exceptions.
It allows to min SQL statements with procedural statements like IF statement, Looping structures etc.
PL/SQL program units are generally categorized as:
Anonymous blocks
Stored procedures
PL/SQL Engine
Every PL/SQL block is first executed by PL/SQL.
This is the engine that compiles and executes PL/SQL blocks.
PL/SQL engine executes all procedural statements of
PL/SQL of the block, but sends SQL commands to SQL statements executor in the ORACLE RDBMS.
Variables in PL/SQL
Used to store numbers, character strings, dates, and other data values
Avoid using keywords, table names and column names as variable names
Must be declared with data type before use: variable_name data_type_declaration;
Manipulating Character Strings with PL/SQL
To change case, use UPPER, LOWER, INITCAP
INSTR function searches a string for a specific substring:
start_position := INSTR(original_string, substring);
SUBSTR function extracts a specific number of characters from a character string, starting at a given point:
extracted_string := SUBSTR(string_variable, starting_point, number_of_characters);