Sql ORA-06532:下标超出限制

Sql ORA-06532:下标超出限制,sql,oracle,plsql,Sql,Oracle,Plsql,请帮助我理解为什么第二个块抛出错误,但第一个块正在运行。这两个地方的限制都小于声明的大小(41) 例外情况: **Error :** Error report - ORA-06532: Subscript outside of limit ORA-06512: at line 6 06532. 00000 - "Subscript outside of limit" *Cause: A subscript was greater than the limit of a varray

请帮助我理解为什么第二个块抛出错误,但第一个块正在运行。这两个地方的限制都小于声明的大小(41)


例外情况:

**Error :**
Error report -
ORA-06532: Subscript outside of limit
ORA-06512: at line 6
06532. 00000 -  "Subscript outside of limit"
*Cause:    A subscript was greater than the limit of a varray
           or non-positive for a varray or nested table.
*Action:   Check the program logic and increase the varray limit
           if necessary.
10

extend
的参数是要添加到数组中的项数,而不是最终大小

当你在原来的四个数的基础上加上三十八,得到四十二,这肯定大于四十一。嗯,那是在我上学的时候,但我很肯定,如果他们颁布了这样的规定,我会听到这样的变化:——)

第一个是有效的,因为六加四只能得到十,远低于四十一的极限

Declare
  Type typ_int_array IS VARRAY(41) OF NUMBER;
  v_typ_int_array typ_int_array := typ_int_array(10,20,30,40);
BEGIN
  SYS.DBMS_OUTPUT.PUT_LINE(v_typ_int_array(1));
  v_typ_int_array.extend(38);
  v_typ_int_array(38) := 60;    
END;
**Error :**
Error report -
ORA-06532: Subscript outside of limit
ORA-06512: at line 6
06532. 00000 -  "Subscript outside of limit"
*Cause:    A subscript was greater than the limit of a varray
           or non-positive for a varray or nested table.
*Action:   Check the program logic and increase the varray limit
           if necessary.
10