Results 1 to 3 of 3

Thread: Unbounded Array

  1. #1
    Join Date
    May 2011
    Posts
    36

    Unanswered: Unbounded Array

    What actually the error is:

    Declare
    Type Enum is table of Emp.Empid%type;
    Eno Enum;
    Begin
    Eno(1) := 'E111';
    Eno(2) := 'E222';
    Eno(3) := 'E333';
    Eno(4) := 'E444';
    Eno(5) := 'E555';
    for i in Eno.First .. Eno.Last
    loop
    dbms_output.put_line(Eno(i));
    End loop;
    End;

    Error Message:
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at line 5
    06531. 00000 - "Reference to uninitialized collection"

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Code:
    06531, 00000, "Reference to uninitialized collection"
    // *Cause:  An element or member function of a nested table or varray
    //          was referenced (where an initialized collection is needed)
    //          without the collection having been initialized.
    // *Action: Initialize the collection with an appropriate constructor
    //          or whole-object assignment.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Mar 2007
    Posts
    623
    Quote Originally Posted by GaneshAnanth View Post
    What actually the error is:
    What actually you should study is: PL/SQL User's Guide and Reference, especially the chapter about PL/SQL collections. It is available with other Oracle documentation books e.g. online on http://tahiti.oracle.com/

    A short description of PL/SQL collection usage is also shown here: http://www.oracle-base.com/articles/...bleCollections
    Notice the use of collection constructor (initializing it) and EXTEND method (extending it). Your code misses both.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •