Index | Home | Forums
Oracle PL/SQL Example 1-15 Using a PL/SQL Collection Type

Example 1-15 Using a PL/SQL Collection Type

DECLARE
  TYPE staff_list IS TABLE OF employees.employee_id%TYPE;
  staff staff_list;
  lname employees.last_name%TYPE;
  fname employees.first_name%TYPE;
BEGIN
   staff := staff_list(100, 114, 115, 120, 122);
   FOR i IN staff.FIRST..staff.LAST LOOP
     SELECT last_name, first_name INTO lname, fname FROM employees 
       WHERE employees.employee_id = staff(i);
     DBMS_OUTPUT.PUT_LINE ( TO_CHAR(staff(i)) || ': ' || lname || ', ' || fname );
   END LOOP;
END;
/


This page was created by oracleabc.com on Feb 23,2008 00:09:02
General comments and questions regarding this document should be sent by email to info@oracleabc.com or post your comments here