Oracle数组维度

/*oracle 一维数组*/
DECLARE
  TYPE T_VARRAY IS VARRAY(3) OF VARCHAR2(20);
  V_VAR T_VARRAY := T_VARRAY('I', 'LOVE', 'STUDY');
BEGIN
  FOR I IN 1 .. V_VAR.COUNT LOOP
    DBMS_OUTPUT.PUT_LINE(V_VAR(I));
  END LOOP;
END;
/

/*二维数组*/

DECLARE

  TYPE T_VARRAY IS VARRAY(5) OF NUMBER;

  TYPE T_VARRAY_VARRAY IS VARRAY(2) OF T_VARRAY;

  V_VAR T_VARRAY_VARRAY := T_VARRAY_VARRAY(T_VARRAY(11, 12, 13, 14, 15),

                                           T_VARRAY(21, 22, 23, 24, 25));

BEGIN

  FOR I IN 1 .. V_VAR.COUNT LOOP

    FOR J IN 1 .. V_VAR(I).COUNT LOOP

      DBMS_OUTPUT.PUT_LINE(V_VAR(I) (J));

    END LOOP;

  END LOOP;

END;

/

你可能感兴趣的:(Oracle数组维度)