Solved

FORMS--- Populate a VARRAY

Posted on 2006-11-30
1
1,005 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 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
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 shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now