Question : ORA: 6533 Subscript out of range

At the line  PREC_CEP_CALCULATIONS_ARRAY.EXTEND;  I am getting the out of subscript error.  

I used the data at this web page to create my 2-dimensional array.  
http://www.oracle.com/technology/oramag/oracle/06-jan/o16plsql.html

In the watch, the array doesn't appear to any elements, it has had just one in other attempts.  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
create or replace
PROCEDURE PREC_CEP_CALCULATED
AS
BEGIN
  DECLARE
    PREC_CEP_CALCULATIONS_ARRAY twodim_varray.array_t
      := twodim_varray.array_t();
    MPI_D_DF NUMBER(10,6);
    MPI_D_RG NUMBER(10,6);
    S_DF NUMBER(10,6);
    S_RG NUMBER(10,6);
    i NUMBER;
    j NUMBER;
    k NUMBER;
    l NUMBER;
    CEP NUMBER(10,6);
    TYPE RADIUS_ARRAY IS VARRAY(475) OF NUMBER(10,3);
    RADIUS RADIUS_ARRAY := RADIUS_ARRAY();
    delta_range NUMBER(10,3);
    STEP_RADIUS NUMBER(10,3);
    TYPE THETA_ARRAY IS VARRAY(507) OF NUMBER(10,2);
    THETA THETA_ARRAY := THETA_ARRAY();
    STEP_THETA NUMBER(10,2);
    
  BEGIN
    SELECT dR INTO delta_range FROM INTEGRATION_VARIABLES;
      radius.extend(475);
    FOR i IN 1 .. 475 LOOP
      STEP_RADIUS:= delta_range * (i-1);
      RADIUS(i):= STEP_RADIUS;
    END LOOP;
    
      THETA.EXTEND(507);
    FOR i IN 1 .. 507 LOOP
      STEP_THETA:= (3.141/253) * (i-1);
      THETA(i) := STEP_THETA;
    END LOOP;
    
    PREC_CEP_CALCULATIONS_ARRAY.EXTEND;
    PREC_CEP_CALCULATIONS_ARRAY(475)
      := twodim_varray.data_t();
    PREC_CEP_CALCULATIONS_ARRAY(507).EXTEND;
    PREC_CEP_CALCULATIONS_ARRAY (1) (1) := 0;

    SELECT MPI_DELTA_DF INTO MPI_D_DF FROM INTEGRATION_VARIABLES;
    SELECT MPI_DELTA_RG INTO MPI_D_RG FROM INTEGRATION_VARIABLES;
    SELECT SIGMA_DF INTO S_DF FROM INTEGRATION_VARIABLES;
    SELECT SIGMA_RG INTO S_RG FROM INTEGRATION_VARIABLES;

    
    FOR k IN 1 .. 475 LOOP
      FOR l IN 1 .. 507 LOOP
        CEP:=PREC_CEP_CALCULATION(THETA(l), RADIUS(k), S_DF, S_RG, MPI_D_DF, MPI_D_RG);
        prec_cep_calculations_array(k)(l):= CEP;
      END LOOP;
    END LOOP;
  END;
END PREC_CEP_CALCULATED;

Answer : ORA: 6533 Subscript out of range

Let's make your example easier...

yes, you can extend to the limit of the varray, but you must initialize it to an empty array first.

Since there isn't really a two dimensional construct, you must initialize each nested varray as well, then extend each of them.

The snippet below shows how to fully initialize both dimensions.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
DECLARE
    TYPE data_t IS VARRAY(475) OF NUMBER;

    TYPE array_t IS VARRAY(507) OF data_t;

    v_array array_t := array_t();
BEGIN
    v_array.EXTEND(507);

    FOR i IN 1 .. v_array.COUNT
    LOOP
        v_array(i) := data_t();
        v_array(i).EXTEND(475);
    END LOOP;
END;
Random Solutions  
 
programming4us programming4us