Oracle Function by examples

Functions are another type of stored code and are very similar to procedures. The significant difference is that a function is a PL/SQL block that returns a single value. Functions can accept one, many, or no parameters, but a function must have a return clause in the executable section of the function. The datatype of the return value must be declared in the header of the function.

Function Syntax

The syntax for creating a function is as follows:

CREATE [OR REPLACE] FUNCTION function_name
(parameter list)
RETURN datatype
IS
BEGIN
RETURN (return_value);
END;

The function does not necessarily have any parameters, but it must have a RETURN value whose datatype is declared in the header. 

Function Example


Invoking the Function


Passing Parameter to Function


Invoking the Function with a Parameter


Use Function in Oracle Form Developer 10g

Comments

Popular posts from this blog

What is Oracle Integration Cloud Service - ICS?

How to Create Packages in Oracle Database using TOAD for Oracle

How to create a Simple Scheduler Job in Oracle Database using Toad