when I am multiplying the index by 3 instead of one, three rows are getting inserted into the associative array and also it seems that the 2nd and 3rd rows have no value present.
- So how are the rows getting inserted when I write
select last_name into emp_table(i*3) from employees. - Could you also tell what
emp_table.first..emp_table.lastis doing i.e. is it returning some kind of reference to the Associative array or is it just returning the first and last index of the columns of the array. in which case how does it work if the list is not ordered and has gaps. - What is happening when I delete a column, is that only the value is getting deleted and the index remains.
DECLARE
TYPE emptype IS
TABLE OF employees.last_name%TYPE INDEX BY PLS_INTEGER;
emp_table emptype;
BEGIN
FOR i IN 100..105 LOOP
SELECT
last_name
INTO
emp_table(i * 3)
FROM
employees
WHERE
employees.employee_id = i;
END LOOP;
--emp_table.delete('303');
FOR i IN emp_table.first..emp_table.last LOOP
--dbms_output.put_line(emp_table(i));
dbms_output.put_line(i);
END LOOP;
END;