Merge collections ? [message #625902] |
Wed, 15 October 2014 19:18 |
|
lijjumathew
Messages: 2 Registered: October 2014
|
Junior Member |
|
|
I need to merge two collections. I know two tables can be merged , but not sure of collections.
What is the best way to merge collections ?
Say below is the sample code
------------
CREATE OR REPLACE TYPE obj_test AS OBJECT(
id number(9),
val number (9)
)
/
CREATE OR REPLACE TYPE obj_test_list AS TABLE OF obj_test
/
I have two lists/collections
list1 obj_test_list ;
list2 obj_test_list ;
list3 obj_test_list ;
list1 list2
id val id val
1 100 1 300
2 200 4 500
3 300
I want to match list1 and list2 based on id and add val else insert.
I want it in list3 as follows.
list3
id val
1 400
2 200
3 300
4 500
Can someone give a sample code for this?
Thanks
Matt
|
|
|
|
|