Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle user defined object types
"Jeff Smith" <jsmit234_at_ford.com> wrote in message news:<b3d8lr$7d318_at_eccws12.dearborn.ford.com>...
> 12 tmpjeffobj.extend; /* THIS ADDS AN ELEMENT */
> 13 dbms_output.put_line( 'NEW COUNT: ' || to_char(tmpjeffobj.count) );
> 14 tmpjeffobj(3).ID_FLG := 'Y';
> 15
> 16 end;
> 17 /
> Original count: 2
> BB
> After attempting to change element 2 count: 2
> NEW COUNT: 3
> DECLARE
> *
> ERROR at line 1:
> ORA-06530: Reference to uninitialized composite
> ORA-06512: at line 14
>
>
You already solved the problem, but IIRC after an EXTEND you must
initialize (instantiate?) the new element. This is done using the
default constructor for the object type, if you didn't write a specific
one.
Using your code, something like this should work:
> 12 tmpjeffobj.extend; /* THIS ADDS AN ELEMENT */
tmpjeffobj(tmpjeffobj.count)(); -- default constructor.
> 13 dbms_output.put_line( 'NEW COUNT: ' || to_char(tmpjeffobj.count) );
> 14 tmpjeffobj(3).ID_FLG := 'Y';
Cheers
Nuno Souto
wizofoz2k_at_yahoo.com.au.nospam
Received on Tue Mar 25 2003 - 16:31:18 CST