title: oracle substr function with delimiter scope
body: <p>I am trying to find the nearest delimiter to a substr with a limit on the number of characters.</p>
  
  <pre><code>Eg: select 'oneone,twotwo, threethree, four,five,six,seven,eight,nine,ten,eleven,twelve' from dual;
  </code></pre>
  
  <p>Now, I want to cap the substr to pull only the first 30 characters from this string while also ensuring the substr end with the nearest "," if it cannot find the end point in the 30 characters.</p>
  
  <pre><code>select substr('oneone,twotwo, threethree, four,five,six,seven,eight,nine,ten,eleven,twelve',1,30) from dual ;-- First 30 characters.
  </code></pre>
  
  <p>The first 30 characters produces: oneone,twotwo, threethree, fou
  But, I want the expected result to find the nearest delimiter "," before the incomplete entry of "fou" and get the result.</p>
  
  <pre><code>Expected Result:oneone,twotwo, threethree -- since "fou" is incomplete and thus should be excluded
  </code></pre>