Functions

Functions are program units that return a value through RETURN clause.

CREATE [OR REPLACE] FUNCTION function_name
— datatype should not be constrained by size (NUMBER is correct, NUMBER(10) is not correct)
[(parameter_name [IN|OUT|IN OUT] datatype [ { :=|DEFAULT} value] [,parameter2])]
RETURN return_datatype
{IS|AS}
declaration_section
BEGIN
executable_section (here must be at least one RETURN statement)
[EXCEPTION
exception_section]
END [function_name];

For a function to be called from SQL only IN parameters are allowed (NO OUT or IN OUT). Then the return value must be compatible with RDBMS datatypes (no BOOLEAN or programmer-defined records) and the function must be stored in the database.

List of PL/SQL built in functions can be found here https://vladimiroracle.wordpress.com/plsql/built-in-functions/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: