title: How to execute a Stored Procedure with RECORD TYPE as OUT parameter
body: <p>This is the package specification:   </p>
  
  <pre><code>create or replace PACKAGE EMPLOYEE_DETAILS AS
  
          TYPE DETAILS IS RECORD( 
          EMPLOYEE_ID NUMBER(6,0),
            EMPLOYEE_FIRST_NAME VARCHAR2(20),
            EMPLOYEE_LAST_NAME VARCHAR2(25)
            );
  
          TYPE TABLE_EMPLOYEES IS TABLE OF DETAILS;
  
          PROCEDURE GET_EMPLOYEES(
          EMP_DEPT_ID EMPLOYEES.DEPARTMENT_ID%TYPE,
          EMP_SALARY employees.salary%TYPE,
          TBL_EMPLOYEES OUT TABLE_EMPLOYEES
          );
  
          END EMPLOYEE_DETAILS;
  </code></pre>
  
  <p>And this is the package body. I was able to compile the package but need some help on executing the stored procedure to verify the results.</p>
  
  <pre><code>create or replace PACKAGE BODY EMPLOYEE_DETAILS AS
  
      PROCEDURE GET_EMPLOYEES(
      EMP_DEPT_ID EMPLOYEES.DEPARTMENT_ID%TYPE, 
      EMP_SALARY employees.salary%TYPE,
      TBL_EMPLOYEES OUT TABLE_EMPLOYEES
  )
  
  IS
      LC_SELECT SYS_REFCURSOR;
      LR_DETAILS DETAILS;
      TBL_EMPLOYEE TABLE_EMPLOYEES;
  
  BEGIN
      OPEN LC_SELECT FOR 
          SELECT EMPLOYEE_ID,FIRST_NAME,LAST_NAME 
          FROM EMPLOYEES
          WHERE DEPARTMENT_ID=EMP_DEPT_ID
          AND EMPLOYEES.SALARY&gt;EMP_SALARY;
  
      LOOP 
          FETCH LC_SELECT INTO LR_DETAILS;
          EXIT WHEN LC_SELECT%NOTFOUND;
  
          IF IS_EMPLOYEE(LR_DETAILS.EMPLOYEE_ID) THEN
              TBL_EMPLOYEE.extend();
              TBL_EMPLOYEE(TBL_EMPLOYEE.count()) := LR_DETAILS;
          END IF;
      END LOOP;
      CLOSE LC_SELECT;
      TBL_EMPLOYEES := TBL_EMPLOYEE;
  
  END GET_EMPLOYEES;
  END EMPLOYEE_DETAILS;
  </code></pre>
  
  <p>What I've have so far is:</p>
  
  <pre><code>set serveroutput on
  declare 
  tbl_employees table_employees;
  begin
  employee_details.get_employees(30,1000,tbl_employees);
  
  For i IN tbl_employees.First .. tbl_employees.Last Loop
  dbms_output.put_line(tbl_employees(i).employee_id || ' ' ||
                                  tbl_employees(i).first_name|| ' ' ||
                                  tbl_employees(i).last_name);
  End Loop;
  end;
  </code></pre>
  
  <p>But when I execute this it gives me error saying</p>
  
  <blockquote>
    <p><code>table_employees</code> must be declared </p>
  </blockquote>
  
  <p>and the other one is </p>
  
  <blockquote>
    <p>PLS-00320: the declaration of the type of this expression is incomplete or malformed. </p>
  </blockquote>
  
  <p>Can somebody please help me with this?</p>