Re: PL/SQL Table of records

From: <als_at_akc.org>
Date: Fri, 24 Apr 1998 06:41:46 -0600
Message-ID: <6hptpq$bqm$1_at_nnrp1.dejanews.com>


That is a wild one. One thing that I do when I use a table of records it to define a "mirrored" record with each of the individual attributes set to null.  I then set my table row to the rec_my_rec_null record type. That's another thing that I wish PL/SQL would let me do, but won't. That is, set the t_plsql_row (n) := null; It will not let me do that but will let me do the t_plsql_row (n) := rec_my_rec You may want to ask (beg) your programmer to do the same for you. In your case, the nvl not working is the most troublesome thing to me.

In article <353F9B22.1243_at_compuserve.com>#1/1,   graeme_king_at_compuserve.com wrote:
>
> Hi folks
>
> Has anyone experienced this problem...
>
> I have declared a PL/SQL Table of records i.e each created row in the
> table will be a record.
>
> For example the record will be made up of 3 items a,b and c. The items
> can be of any type eg Varchar2,number....
>
> If I insert data into a row of the table assigning values for items a
> and b and then attempt to read/reference the value of c I get the
> Exception VALUE_ERROR. If however I assign NULL to c, I can then
> read/reference it OK.
>
> I also tried declaring the record items ALL with default values of NULL
> but this does not fix the problem. I believe that this may be a bug in
> PL/SQL?
>
> This appears to be the only time PL/SQL doesn't like you referencing a
> variable if it is not defined with a value. The same code for an
> identical record (ie not within a PL/SQL Table) doesn't produce this
> error. Nor does referencing an undefined variable....
>
> Obviously referencing undefined variable is bad programming practice but
> in the case of a PL/SQL Table of records which is passed to my procedure
> to process it is likely that not all items in the record/row will be set
> and even performing an NVL on such an item causes VALUE_ERROR.
>
> The only solution seems to be to explicitly set all record items in the
> row of the table to NULL if you are going to assign values to any item
> in the row. Unfortunately in my case I have to rely on the programmer
> passing me the table to initialise the every item in every row.
>
> Does anyone have a better solution?
>
> Thanks in advance
>
> Graeme King
> Please reply to graeme.king_at_scottishpower.plc.uk
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Fri Apr 24 1998 - 14:41:46 CEST

Original text of this message