| Users Online : 1234 | Tuesday 06th of January 2009 | ![]() |
![]() |
|
|
|||||||||||
CBSE eBooks CBSE Guess > eBooks > Class XII > Informatics Practices By Agnelo Procedures Functions
PL/SQL provides packaging mechanism for small blocks of procedural code: PROCEDURE ProcName(ArgList) IS FUNCTION FuncName(ArgList) RETURN Type IS Each argument has a mode:
Can also specify a DEFAULT value for each argument. Procedures can be called in the usual manner:
Or can be called via named parameters e.g. Procedure Example A procedure to raise the salary of an employee: EXCECPTION HANDLING (HANDLING ERRORS) : it’s a PL/SQL procedure. General Syntax BEGIN EXCEPTION END; It is an exception condition where the oracle engine FAILS S to understand what is the next course of action, this condition is called exception and we need to handle it They are 2 types
PRE DEFINED: TWO_MANY ROWS These are automatically defined They do not need to be declared in the DECALRE in the PL/SQL BLOCK, that can be directly handled by the ORACLE database engine. USER DEFINED EXCEPTION They need to be declared in the DECALRE in the PL/SQL BLOCK. SYNTAX: DECALRE BEGIN EXCEPTION Define the Exception; END; FUNCTIONS AND PROCEDURES Functions and Procedures can be created and replaced Named PL/SQL block programs which are created, compiled and saved in the database. Procedures and functions are general purpose programs which can be called in the PL/SQL block program. 3 steps
Create or replace procedure P1 ( a IN NUMBER, b IN NUMBER, c OUT NUMBER) IS / AS Begin c = a + b; End; EXAMPLE:
We can INSERT, UPDATE , DELETE. THEY are created and stored n the database when a DML statement is issued against the table ORACLE engine searches for associated Trigger, and If the trigger is associated the DATABASE TRIGGER will execute. They consist of 3 parts
|
|
About Us - Success Stories - Guest Book - RSS Feeds - Education Forum - Contact Us - Help - Links - Advertise With Us - Terms of Service - Privacy Policy
© 2003-2007, CBSE Guess.com Website Designing, Website Development, Search Engine Promotion, Web Hosting By: DreamzSop Advertising Private Limited. |
||||||||||||||||||||||||||||||