MarthinusSwart.com

PL/SQL Functions and Procedures.

To declare functions and / or procedures in PL/SQL is very straight forward once you know the keywords and syntax.

To declare a function the syntax is a follows:

FUNCTION calculate_term(maturity_start_date IN DATE, maturity_end_date IN DATE) RETURN NUMBER;

The IN keyword specifies that the parameter is an input only parameter. The RETURN keyword determines what data type will be returned to the caller.

PROCEDURE Load(di_fin_year_code IN CHAR, di_fin_month_code IN CHAR, a_perform_s INTEGER DEFAULT 1);

The DEFAULT keyword specifies that the parameter has a default value. That means that if the variable value is 1 the variable may be omitted by the caller.