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;
/
0 comments:
Post a Comment