title: Pass multiple rows or array to DB2 Store procedure from java
body: <p>We need to update <strong>DB2</strong> database with following type of data with <strong>store procedure</strong> from java application.</p>
  
  <pre><code>ManId ManaFirstName ManLastName CubicleId Unit EmpId EmpFirstName EmpLastName
  2345  Steeven        Rodrigue   12345RT HR     2456     John        Graham
                                                 45464    Peter       Black
  </code></pre>
  
  <p>Here, the columns related Emp (Emp Id , Emp First Name and Emp Last Name) is actually array, it can any number of employees from my front application for one manager.
  We need to pass  these values in Store Procedure and process in SP. However, I am not able to find any array type datatype in db2.</p>
  
  <p>I know I can take following two approaches :-
  1. Delimited value :- Have  varchar column and append all the values with help of delimiter and split in SP.</p>
  
  <pre><code>                     2456,John,Graham|45464,Peter,Black
  </code></pre>
  
  <p>2. Have separate SP and call in batch.</p>
  
  <p>However, I am looking for approach where I can pass them in single go and some more <strong>structured datatype</strong>. Does DB2 have datatype like array to support this or any way to create custom datatype.</p>
  
  <p>I am using Spring JDBCTemplate at front end to call SP (I am flexible to change that) and DB2 as database.\</p>
  
  <p>P.S. :- Open queries is not option for me , need to call SP only.
  This SP is going to be called from java directly, so if have to use custom datatype, only scope is to define it in store procedure which is being called</p>