Basic Oracle Function Structure
- Joel Lipman
- Oracle PL/SQL
- Hits: 9986
I need to refer to how to create a function in Oracle PL/SQL and sites on the net just attempt to overcomplicate everything and have forgotten how it is to be new to Oracle. I need a function in it's simplest form and if I want to torture my successors, I'll complicate the function myself.
How?
Functions are supposed to return a single value, which is all I need in this case. In my example, I need to submit an Active Directory (AD) username and receive a student ID number instead, all with the aim to improve performance on some SSRS queries which accept either an ID number or an AD name as user parameters.
Syntax:
CREATE [OR REPLACE] FUNCTION function_name [ (parameter [,parameter]) ] RETURN return_datatype IS | AS [declaration_section] BEGIN executable_section [EXCEPTION exception_section] END [function_name];
- CREATE [OR REPLACE] FUNCTION function_name
- [ (parameter [,parameter]) ]
- RETURN return_datatype
- IS | AS
- [declaration_section]
- BEGIN
- executable_section
- [EXCEPTION
- exception_section]
- END [function_name];