PL/SQL table

From Oracle FAQ
Jump to: navigation, search

A PL/SQL Table is an associative array (or INDEX-BY table) that can be indexed by NUMBER or VARCHAR2.

Elements are retrieved using number or string subscript values. Unlike with normal data tables, PL/SQL tables are stored in memory. PL/SQL Tables are sparse and elements are unordered.

[edit] Example

CREATE OR REPLACE PROCEDURE testing IS
  TYPE testarr_typ IS TABLE OF VARCHAR2(150) INDEX BY PLS_INTEGER;
  v_testarr testarr_typ;
BEGIN
  FOR y IN 1..5 LOOP
     v_testarr(y) := 'HELLO'||y;
     dbms_output.put_line(v_testarr(y));
  END LOOP;
END;
/
Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #