title: Split a VARCHAR in DB2 to retrieve a value inside
body: <p>I have a <code>VARCHAR</code> column that contains 5 informations (2 <code>CHAR(3)</code> and 3 <code>TIMESTAMP</code>) separated with '<code>$</code>'. </p>
  
  <pre><code>CREATE TABLE MYTABLE (
    COL VARCHAR(256) NOT NULL
  );
  
  INSERT INTO MYTABLE 
  VALUES
      ( 'AAA$000$2009-10-10 10:50:00$null$null$null' ),
      ( 'AAB$020$2007-04-10 10:50:00$null$null$null' ),
      ( 'AAC$780$null$2007-04-10 10:50:00$2009-04-10 10:50:00$null' )
  ;
  </code></pre>
  
  <p>I would like to extract the 4th field ...</p>
  
  <pre><code>'AAA$000$2009-10-10 10:50:00$null$null$null'
                               ^^^^ this field
  </code></pre>
  
  <p>... to have something like</p>
  
  <pre><code>SELECT SPLIT(COL, '$', 4) FROM MYTABLE
  
  1
  -----
  'null'
  'null'
  '2009-04-10 10:50:00'
  </code></pre>
  
  <p>I'm searching, in that order : </p>
  
  <ol>
  <li>A DB2 build-in string function</li>
  <li>An <em>embeddable</em> statement such as <code>SUBSTR(COL, POSSTR(COL)+1)...</code></li>
  <li>An user defined function that behaves like <code>SPLIT</code></li>
  </ol>
  
  <p>Precision : Yes, I <strong>do</strong> know that it's not a good idea to have such columns...</p>