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!

Collection or Nested Table?

BMax007Feb 25 2008 — edited Feb 25 2008
I am developing an equipment ordering system and one scenario involves ordering kits. The kit is comprised of a parent item and multiple child items. I am currently selecting the parent item from a table "EQP_KIT" that has the defined manufacture/model/type as a number for the parent items in the column PARENT and the same for the child items in the column CHILD.

Using a cursor I loop through the table and display all of the child items including their primary key "PID" and display that in HTML as a form with hidden text inputs with values “childpid = rstChild.PID and parentpid = rstParent.PID and a hidden text input named addchild with the value “add” as an input submit button to submit the form.

Each time the submit button is pressed an IF statement evaluates the value of addchild and if addchild = ‘add’ then the value of the parameter childpid is added to the column CHILD_PID in the table KIT_ORDER along with PARENT_PID = parentpid.

My thought was to create a collection that will hold the order_id, parentpid’s and all of the childpid’s. I would loop through the EQP_KIT table and retrive all the values in the CHILD column where the PARENT column = ‘parentpid’.

Next I would display the child items in a form as described above and when pressing the add button the IF statement would become true and the item is added to the collection rather than making an update to the KIT_ORDER table.

Once I have finished selecting the childpids then I would press the submit button to finalize the order.

Once I have submitted the order then I would loop through the collection and insert the values of the collection into the KIT_ORDER table.

Or…

Do I create a column in KIT_ORDER table that holds a nested table with the values of parentpid,childpid?

Obviously this is new to me and I would appreciate and guidance you may provide.

Max
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 24 2008
Added on Feb 25 2008
1 comment
336 views