Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

FORMS--- Populate a VARRAY

Posted on 2006-11-30
1
Medium Priority
?
1,023 Views
Last Modified: 2008-02-01
How do I move/populate a VARRAY from a form?

This is my Varray , definied in the form:
TYPE detail_record is record (
   alloc_id    number,
  cust_id     number);
Type CUST_ARRAY is varray(20) of DETAIL_RECORD;
CUST_FERC  CUST_ARRAY.

This is my code to populate the varray:
if :form_cust_id1 >0 then
   cust_ferc(1).cust_id        := :form_CUST_ID1;
   cust_ferc(1).alloc_id       := :form_alloc_ID1;
end if;

if :form_cust_id2 >0 then
   cust_ferc(2).cust_id        := :form_CUST_ID2;
   cust_ferc(2).alloc_id       := :form_alloc_ID2;
end if;

is this the correct way? beacuse I also get an ORA-06531 error which implies that teh array wa not populated.



   
0
Comment
Question by:joekeri
1 Comment
 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 150 total points
ID: 18051409
CUST_FERC  CUST_ARRAY := cust_array(); -- to initialize with non null but empty by using the constructor;

say cust_ferc.extend;

then say something like cust_ferc(1).cust_id := :form_cust_id2;

similarly say extend again and then go ahead and use the second element.

If u dont want to use extend then do something like this after the begin statement

cust_ferc := cust_array((1,1),(2,2)); -- this will create 2 elements with the constructor.

For more information refer to online oracle pl/sql documentation which has good examples of sample code of varrays , nested tables, associative arrays etc.

Thanks
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question