3.1 PLSQL PPT Ch3 PDF
3.1 PLSQL PPT Ch3 PDF
Functions Syntax
Functions Demonstration
HOMEWORK
What is
Functions?
The function must return a value but in Stored Procedure it is optional. Even a
procedure can return zero or n values. Functions can have only input parameters
for it whereas Procedures can have input or output parameters. Functions can be
called from Procedure whereas Procedures cannot be called from a Function.
Stored Functions Syntax
CREATE OR REPLACE FUNCTIONS Output parameter is a parameter whose
value is passed out of the stored
<function_name> procedure / function module, back to the
(Argument {IN, OUT, IN/OUT }* calling PL/SQL block. An OUT parameter
must be a variable, not a constant.
<Data type> )Return <var> IS,AS It can be found only on the left-hand side
<variable> declaration; of an assignment in the module.
PL/SQL functions can't able to return multiple
<constant> declarations; values,it can return only one (single
BEGIN )values using OUT parameters in their
<PL/SQL subprogram body>; arguments.
EXCEPTION PL/SQL BLOCK>; *IN – parameter will accept a value from user
Return <variable> OUT – Parameter will return value to user
END <function_name>;
Stored Function Demonstration
Table A
COLA COLB
ROW11 20
ROW21 12
Practice Project
STUDENT
Stored Trigger
PL/SQL Functions
Procedure