Development and Programming
ORA-06531: reference to uninitialized collection
When I try to run the following Oracle PL/SQL block:
I got the error:
ORA-06531: Reference to uninitialized collection
ORA-06512: at line 11
The nested table variable has to be initialized and extended before you can use it in the assignement statement.
type nested_type is table of number;
v1 nested_type := nested_type();
for i in 1..10
v1(i) := i;
for j in 1..v1.COUNT
You can also define v1 as a variable of an associative array type, then it will be initialized automatically.
type nested_type is table of number INDEX BY PLS_INTEGER;
© 2018 Digcode.com. All rights reserved.