user109444
user109444

Reputation: 29

How to create a multidimensional array

I am struggling a little understanding how this is done, and would really appreciate if someone could walk me through how a 2d array in PL/SQL is made?

Upvotes: 0

Views: 802

Answers (1)

Ajay Gupta
Ajay Gupta

Reputation: 514

You can think of the following code as each row in table2 has a collection of type table1. You can insert any number of values as is shown in BEGIN.

DECLARE

TYPE table1 IS TABLE OF NUMBER 
  INDEX BY PLS_INTEGER;

TYPE table2 IS TABLE OF table1
  INDEX BY PLS_INTEGER;
var_i table2

BEGIN

var_i (1) (1) := 1;
var_i (1) (2) := 12;

END;

Upvotes: 1

Related Questions