Solved

FORMS--- Populate a VARRAY

Posted on 2006-11-30
1
1,017 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

617 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