I would like to create an Oracle package accessing an Oracle object of table type.
CREATE OR REPLACE TYPE t_dept_avg_rec AS OBJECT(
dept number,
age number
)
CREATE OR REPLACE TYPE t_dept_avg_tab IS TABLE OF t_dept_avg_rec
Insert few records into the above object type table as mentioned below.
dept, age
----- ---
- 20, 60
- 30, 40
- 20, 24
- 30, 66
Then create a separate oracle pipelined function to return the following result.
select dept, avg(age)
from t_dept_avg_tab
group by dept;
Is this possible using Oracle objects?