title: How to split string in based on a certain delimiter in DB2 without creating stored procedure
body: <p>I have the below a varchar column called "Person_Info" in DB2. I need split the its values using "_" and get the third token in DB2. Then convert it into integer.</p>
  
  <pre><code>Person_Info
  ----------------
  Person_BILL_1234_1511011900
  Person_BOB_88888
  Person_MARIOSAN_10_1511011900
  </code></pre>
  
  <p>The output should be:</p>
  
  <pre><code>1234
  88888
  10
  </code></pre>
  
  <p>I have checked this post <a href="https://stackoverflow.com/questions/18961996/how-to-split-a-string-value-in-db2">How to split a string value based on a delimiter in DB2</a>. It doesn't really solve this particular case.</p>
  
  <p>Have also checked this post <a href="https://stackoverflow.com/questions/1305804/split-a-varchar-in-db2-to-retrieve-a-value-inside">Split a VARCHAR in DB2 to retrieve a value inside</a>, but it requires creating an stored procedure. I can't just create a stored proc in the production environment for some utility function.</p>
  
  <p>Currently, I have tried:</p>
  
  <pre><code>Select INTEGER(
      SUBSTR(
          Person_Info, LOCATE('_', Person_Info, 10) + 1, 2
      )
  ) from PersonTable
  </code></pre>
  
  <p>But it only works for "<strong>Person_MARIOSAN_10_1511011900</strong>".</p>
  
  <p>So is there any solution to achieve this without creating any stored procedure? Especially if the solution is not bound to any hard coded values like 10 or 2 so that it will work in all the three examples I provided.</p>