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

How to create Oracle stored Procedures using TOAD for Oracle

Create Tables in Oracle Database using TOAD

How to Create Packages in Oracle Database using TOAD for Oracle