Introduction to PL/SQL

What is PL/SQL


Language Structure

          EXCEPTION
 

         - error handling statements

         END;

Notes:

Data Types and Variable Names Examples: Using %type  pfno portfolio.portfoliono%type;  Assignment Statement


Examples:


Comments


Arithmetic Operators


 String Concatenation Operator


Relational Operators


Logical Operators

IF Statement Example: Loops while condition loop
      loop statements
end loop;
for loop_counter in [reverse] startvalue..endvalue loop
     loop statements
end loop;
Example: Using The dbms_output Package Example: The SET SERVEROUTPUT Command SET SERVEROUTPUT ON SIZE buffersize


Exceptions

declare
     invalid_limit exception;
raise invalid_limit;  exception
     when invalid_limit then
        .....;


Accessing a Single Row From a Table Data

select select-list
    into variable-list
    from table-name
    where ....
Using a Cursor to Retrieve Multiple Rows from a Table declare
cursor cursor-name is select-statement;
for row_index in cursor-name loop
      statements to process the current row
end loop;