Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> assigning a rec to pl/sql table element

assigning a rec to pl/sql table element

From: <leo_g_at_my-dejanews.com>
Date: Thu, 30 Jul 1998 15:12:43 GMT
Message-ID: <6pq2hb$1vr$1@nnrp1.dejanews.com>


All of a sudden I ran into a problem with assigning a record to an element of a plsql table. PL/SQL manual says you can do it, I did it myself in other programs but this time it does not work. I wonder if anybody knows what causes it.

In my PL/SQL package I have a routine that receives a record and a PL/SQL table of records of the same type and inserts the record into the table. In this routine (see code below) I calculate the next index as (jobs_tab.COUNT + 1) and assign the record to this element. And this assignment does not work - COUNT does not increase by one as it should (I print the table count before and after teh assignment) . And I get "ORA-01403: no data found" error when trying to read a field from this element. The problem goes away as soon as I switch from assigning a record to assigning one field at a time.

While investigaing this problem I encountered a lot of other weird things. Just one of them. The "no data found" error message mentioned above points to the line where I call the routine but does not point to the line inside the routine where I am trying to access the plsql table element that does not exist.

Here is excerpt of my code.
PROCEDURE insert_rec

    (job_rec_Tab_inout IN OUT job_rec_TabTyp,

         job_rec_in IN jobs%ROWTYPE)   IS
    ind NUMBER;
  BEGIN
ind := 1 + job_rec_Tab_inout.COUNT;
job_rec_Tab_inout(ind) := job_rec_in;
END insert_rec;

job_rec_TabTyp defined in the pkg body as follows

TYPE job_rec_TabTyp IS TABLE OF jobs_table%ROWTYPE

    INDEX BY BINARY_INTEGER; -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Thu Jul 30 1998 - 10:12:43 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US