Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Populating an object able type throug a loop

Bruce ClarkJun 15 2010 — edited Jun 15 2010
Hi:

I need help in figuring out how I can assign objects to an object table type in a loop.

I have the following object type:

create or replace
TYPE xxbst_ste_shiplines_t as OBJECT(
quantity NUMBER,
length NUMBER,
Width NUMBER,
height NUMBER,
dimension_uom VARCHAR2(5),
weight NUMBER,
weight_uom VARCHAR2(5)
);

Then I have a table type based on that object;

create or replace
type xxbst_ste_shiplines_tab_type
AS TABLE OF xxbst_ste_shiplines_t;

Now in my PLSQL procedure I have declare a variable of the table type:

. . .
v_shiplines_tab xxbst_ste_shiplines_tab_type;
. . .

Normally, the process of populating the table type might look like this:
. . .
v_shiplines_tab := xxbst_ste_shiplines_tab_type(xxbst_ste_shiplines_t( 70,32,40,50,'KG',140,'KG'),
xxbst_ste_shiplines_t(14,15,20,30,'KG',42,'KG')
);

. . .

BUT, my requirement is to populate it with a FOR LOOP with each iteration of the loop giving me the set of values.

How can I do thie populating within a loop?

Please please help.


Thanks.

Bruce
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 13 2010
Added on Jun 15 2010
2 comments
596 views