declare
  -- SELECT returns many rows, bulk syntax

  -- dynamic SQL
  -- fails at 9.0.1 with PLS-00597:
  -- expression 'V_EMPRECS' in the INTO list is of wrong type
  v_emprecs Emp_Util.emprec_tab_t;
  v_avg_hire_date employees.hire_date%type := '25-JUN-97';

  cur sys_refcursor;
  v_limit natural := 10;
begin
  open cur for '
    select * from employees where hire_date >= :avg_hire_date'
      using v_avg_hire_date;

  fetch cur bulk collect into v_emprecs limit v_limit; close cur;
  Emp_Util.Show_All ( v_emprecs );
end;
/
-- PL/SQL procedure successfully completed.






declare
  -- alternative syntax, binding explicit column list
  -- to RECORD with corresponding structure
  -- fails at 9.0.1 with PLS-00597:
  -- expression 'V_EMPRECS' in the INTO list is of wrong type

  v_emprecs Emp_Util.emprec_tab_t;
  v_avg_hire_date employees.hire_date%type := '25-JUN-97';
  cur sys_refcursor;
  v_limit natural := 10;
begin
  open cur for '
    select
      employee_id,
      first_name,

      last_name,
      email,
      phone_number,
      hire_date,
      job_id,
      salary,
      commission_pct,
      manager_id,
      department_id
    from employees where hire_date >= :avg_hire_date'

    using v_avg_hire_date;
  fetch cur bulk collect into v_emprecs limit v_limit; close cur;
  Emp_Util.Show_All ( v_emprecs );
end;
/
-- PL/SQL procedure successfully completed.