UNIT-3_Function
UNIT-3_Function
DATABASE SYSTEM-II
Unit:3
RETURN return_datatype
{IS | AS}
BEGIN
END [function_name];
Syntax to create a function:
●
Function_name: specifies the name of the function.
●
[OR REPLACE] option allows modifying an existing function.
●
The optional parameter list contains name, mode and types of the
parameters.
●
IN represents that value will be passed from outside and OUT
represents that this parameter will be used to return a value outside of
the procedure.
Syntax to create a function:
return number
is
n3 number(8);
begin
n3 :=n1+n2;
return n3;
end;
/
Calling a Fuction:
DECLARE
n3 number(2);
BEGIN
n3 := adder(11,22);
END;
/
PL/SQL Drop Function
●
If you want to remove your created function from the database, you
should use the following syntax.