title: Merge collections in oracle?
body: <p>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</p>
  
  <pre><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
  /
  </code></pre>
  
  <p>I have two lists/collections</p>
  
  <pre><code>list1 obj_test_list ;
  list2 obj_test_list ;
  list3 obj_test_list ;
  
  
  list1        
  id val 
  1 100 
  2 200 
  3 300
  
  
  list2       
  id val 
  1 300 
  4 500 
  </code></pre>
  
  <p>I want to match list1 and list2 based on id and add val else insert.
  I want it in list3 as follows. </p>
  
  <pre><code>list3 
  id val 
  1 400 
  2 200 
  3 300
  4 500
  </code></pre>
  
  <p>Can someone give a sample code for this?</p>