Here defining a table type variable and trying to insert rows into that variable using for loop but unable to insert data . Getting data not found error... Please let me know whats wrong with this cod.
DECLARE
TYPE T_EMP
IS
TABLE OF EMP%ROWTYPE INDEX BY BINARY_INTEGER;
V_EMP T_EMP ;
V_MIN_EMP EMP.EMPNO%TYPE;
V_MAX_EMP EMP.EMPNO%TYPE;
BEGIN
--V_MIN_EMP:=7369;
--V_MAX_EMP:=7934;
SELECT MIN(empno) into V_MIN_EMP FROM EMP;
SELECT MAX(EMPNO) INTO V_MAX_EMP FROM EMP;
FOR I IN V_MIN_EMP..V_MAX_EMP
LOOP
SELECT * INTO V_EMP(I) FROM EMP WHERE EMPNO=I;
END LOOP;
END;