Procedures and Functions in PLSQL
Procedures and Functions in PLSQL
By
Parteek Bhatia
Assistant Professor
Dept of Comp Sc & Engg
Thapar University
Patiala
Subprograms
Functions
Stored Subprograms
Local Subprograms
Such procedures and functions are local to the
PL/SQL module, which contain it. They can be
created in the declarative section of PL/SQL
module, local to the module. The local module can
be called anywhere in the module’s execution
section.
Stored Subprograms
A stored procedure or function is a named PL/SQL
code block that have been compiled and stored in
one of the Oracle engine’s system tables.They are
invoked or called by any the PL/SQL block that
appear within an application.
Workshop on Advanced Databases,
Chitkara Univ, By Parteek Bhatia
Difference between Procedure and Function
Note:
If an error occurs during compilation of the procedure or function an invalid
procedure or function is created. These errors can be viewed using the
select statement:
SELECT *FROM USER_ERRORS;
Or
Show errors;
DECLARE
e number;
BEGIN
e:=&empno;
fire_employee(e);
END;
Syntax:
DROP PROCEDURE procedure_name;
Examples:
DROP PROCEDURE process;