Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    153

    Unanswered: Oracle object err: ORA-06530: Reference to uninitialized composite

    Hi All,

    I would like to insert data into a persistent object, but getting following error:

    ORA-06530: Reference to uninitialized composite

    Below is the code:

    drop type TT_test_agmt
    /
    drop type Obj_test_agmt
    /
    CREATE OR REPLACE TYPE Obj_test_agmt AS OBJECT(
    soc_type number(2),
    soc_desc varchar2(20)
    )
    /

    CREATE OR REPLACE TYPE TT_test_agmt IS TABLE OF Obj_test_agmt
    /

    declare

    l_tt tt_test_agmt := tt_test_agmt();

    begin

    for i in 1..10
    loop
    l_tt.extend;

    l_tt(l_tt.last).soc_type := i;
    l_tt(l_tt.last).soc_desc := 'Description:'||to_char(i);
    end loop;
    end;
    /

    It will be nice if any one can help.

    Thanks with Regards,
    JD

  2. #2
    Join Date
    Mar 2007
    Posts
    623
    Object type (here OBJ_TEST_AGMT) has to be initialized with constructor. Assigning its components (as in RECORD type) is not possible before initialization.
    Code:
    declare
      l_tt tt_test_agmt := tt_test_agmt();
    begin
      for i in 1..10 loop
        l_tt.extend;
        l_tt(l_tt.last) := obj_test_agmt( i, 'Description:'||to_char(i) );
      end loop;
    end;
    /
    For further description, please study PL/SQL User's Guide and Reference, available with other Oracle documenattion books e.g. online on http://tahiti.oracle.com/

  3. #3
    Join Date
    Jan 2004
    Posts
    153
    It is working fine.

    Thanks,
    JD

Posting Permissions

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