Oracle Table Functions
A table function is a PL/SQL function which will behave like a row source when queried. So you can perform transformations to the data before it is returned in the result set.
To write a table function, first we need to define an object as the row structure:
1 2 3 4 5 |
CREATE OR REPLACE TYPE emp_table_row AS OBJECT( employee_id NUMBER(6), first_name VARCHAR2(20), last_name VARCHAR2(25)); |
Because our function will return a table, we’ll also define a type:
1 |
CREATE OR REPLACE TYPE emp_table AS TABLE OF emp_table_row; |