DECLARE
TYPE TABLENAMETYPE IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
L_TABLENAMETYPE TABLENAMETYPE;
BEGIN
--YOU CAN USE THIS L_TABLENAMETYPE TYPE HERE
L_TABLENAMETYPE(1) := 'AB';
L_TABLENAMETYPE(2) := 'ABC';
L_TABLENAMETYPE(3) := 'ABD';
L_TABLENAMETYPE(4) := 'ABE';
FOR LDX IN 1 .. L_TABLENAMETYPE.COUNT
LOOP
DBMS_OUTPUT.PUT_LINE(L_TABLENAMETYPE(LDX));
END LOOP;
---DELETE ALL VALUES
L_TABLENAMETYPE.DELETE;
END;
--RESULT
AB
ABC
ABD
ABE
---USE TABLE TYPE WITH BULK COLLECT INTO
DECLARE
CURSOR C IS
SELECT * FROM EMP;
TYPE ANY_TABLE_TYPE IS TABLE OF EMP%ROWTYPE INDEX BY BINARY_INTEGER;
EMP_REC ANY_TABLE_TYPE;
BEGIN
OPEN C;
FETCH C BULK COLLECT
INTO EMP_REC;
CLOSE C;
FORALL I IN EMP_REC.FIRST .. EMP_REC.LAST
UPDATE EMP
SET COMM = EMP_REC(I).SAL * 10 / 100
WHERE EMPNO =
EMP_REC(I).EMPNO;
COMMIT;
END;