Click to See Complete Forum and Search --> : call by reference


shahnehav
08-31-2004, 07:12 AM
select * from table(cast(max_salary_dept(cursor(select * from departments),cursor(select d.department_name , max(e.salary) from employees e , departments d where e.department_id = d.department_id group by d.department_name) )as output_tbl))


When i Execute the above query i get following error :

ERROR at line 1:
ORA-06531: Reference to uninitialized collection
ORA-06512: at "HR.MAX_SALARY_DEPT", line 29

Kinldy,
Resolve this error

padders
08-31-2004, 07:48 AM
Problem is that you declare a variable of type nested table but do not initialise it.

In any case for sparse collections you would want to use associative array, not nested table. Change declaration of "T_DEP_RECORD" to...

TYPE t_dept_record IS TABLE OF departments%ROWTYPE
INDEX BY BINARY_INTEGER;