Function Procedure Packages Oracle PLSQL Tutorial

You call your own functions as you would call any of the built-in database functions.

SQL>
SQL> CREATE OR REPLACE FUNCTION circle_area (p_radius IN NUMBER) RETURN NUMBER AS
  2    v_pi NUMBER := 3.14;
  3    v_area NUMBER;
  4  BEGIN
  5    v_area := v_pi * POWER(p_radius, 2);
  6    RETURN v_area;
  7  END circle_area;
  8  /
Function created.
SQL>
SQL> select circle_area(12) from dual;
CIRCLE_AREA(12)
---------------
         452.16