SQL>
SQL> CREATE TABLE employee (
2 employee_id NUMBER,
3 last_name VARCHAR2(30),
4 first_name VARCHAR2(30),
5 salary NUMBER
6 );
Table created.
SQL> INSERT INTO employee (employee_id, last_name, first_name, salary)VALUES (1, 'G', 'J', 100000);
1 row created.
SQL>
SQL> INSERT INTO employee (employee_id, last_name, first_name, salary)VALUES (2, 'G', 'H', 100000);
1 row created.
SQL>
SQL> SELECT employee_id FROM employee WHERE salary = 10000;
no rows selected
SQL>
SQL> DECLARE
2 TYPE employee_aat IS TABLE OF employee.employee_id%TYPE INDEX BY PLS_INTEGER;
3
4 l_employees employee_aat;
5
6 TYPE boolean_aat IS TABLE OF BOOLEAN
7 INDEX BY PLS_INTEGER;
8
9 l_employee_indices boolean_aat;
10 BEGIN
11 l_employees (1) := 7839;
12 l_employees (100) := 7654;
13 l_employees (500) := 7950;
14 --
15 l_employee_indices (1) := TRUE;
16 l_employee_indices (500) := TRUE;
17 l_employee_indices (799) := TRUE;
18 --
19 FORALL l_index IN INDICES OF l_employee_indices
20 BETWEEN 1 AND 500
21 UPDATE employee
22 SET salary = 10000
23 WHERE employee_id = l_employees (l_index);
24 END;
25 /
PL/SQL procedure successfully completed.
SQL>
SQL> SELECT employee_id FROM employee WHERE salary = 10000;
no rows selected
SQL>
SQL>
SQL> drop table employee;
Table dropped.
SQL>