Solved

FORMS--- Populate a VARRAY

Posted on 2006-11-30
1
1,008 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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Retrieve Values 4 71
Processing of multiple cursor 6 51
SQL Developer 6 51
best datatype for oracle table email creation 8 29
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…
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.
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.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

825 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