Array

From Oracle FAQ
Jump to: navigation, search

An array is a series of variables (or objects) that are of the same type and size. Each of these variables (objects) are indexed; individual elements are called array elements. Arrays can be used in SQL and PL/SQL programs to reduce programming time and improve performance.

PL/SQL Example[edit]

CREATE OR REPLACE PROCEDURE proc1(p_strarr DBMS_SQL.VARCHAR2S) AS
BEGIN
  FOR i IN 1..p_strarr.COUNT LOOP
    dbms_output.put_line('Array element '|| i ||' = ['|| p_strarr(i) ||']');
  END LOOP;
END;
/
-- Test it...
SET SERVEROUTPUT ON
DECLARE
  v_strarr DBMS_SQL.VARCHAR2S;
BEGIN
  v_strarr(1) := 'val1';
  v_strarr(2) := 'val2';
  v_strarr(3) := 'val3';
  proc1(v_strarr);
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 #