title: I got the error ORA-06531: Reference to uninitialized collection
body: <p>Im creating a procedure to display the n number of maximum and minimum salary for an employee. If i ll give 5 as input, the query will get me 5 maximum and minimum salary for an employee.</p>
  
  <p>For the above scenario, I have created an object with two columns like below</p>
  
  <pre><code>create type vrec as object(
  empno number,
  sal number
  );
  /
  </code></pre>
  
  <p>Then i created nested table with the help of object type, so that i can use the nested table as out parameter to return all the rows at one short.</p>
  
  <pre><code>create type vrec_type is table of vrec;
  /
  </code></pre>
  
  <p>After the data type creation, im creating a procedure like below</p>
  
  <pre><code>create or replace procedure pro_first_last1(input in number,salary out vrec_type)
  as
  n number:=0;
  begin
  salary.extend;
  select vrec(empno,sal) into salary(n) from (
  select * from (select empno,sal,rank() over(order by sal asc) min_sal from emp5) where min_sal &lt;= input
  union all
  select * from (select empno,sal,rank() over(order by sal asc) max_sal from emp5) where max_sal &lt;= input);
  n:=n+1;
  for i in 1..salary.count
  loop
  dbms_output.put_line(salary(i).empno||'    '||salary(i).sal);
  end loop;
  end;
  /
  </code></pre>
  
  <p>Also the procedure compiled successfully.</p>
  
  <p>But when i ran the below block to get the output, i got the error "Reference to uninitialized collection"</p>
  
  <pre><code>declare
  input number:=5;
  salary vrec_type;
  begin
  pro_first_last1(input,salary);
  end;
  /
  </code></pre>