title: How to get text from between characters in oracle sql
body: <p>Hi this is my first post and I'm also new to sql. I am trying to extract text from within a string</p>
  
  <p>I have a table column that looks like this</p>
  
  <p><code>site - abc - left</code><br>
  <code>site - def - left</code><br>
  <code>site - ghi - right - inner</code><br>
  <code>site - jkl - right - inner</code><br>
  <code>site - mno</code><br>
  <code>site - pqr</code> </p>
  
  <p>I need a query that would return text inbetween the first two '-' but as per example some only have one '-'. </p>
  
  <p>For example.</p>
  
  <p><code>abc</code><br>
  <code>def</code><br>
  <code>ghi</code><br>
  <code>jkl</code><br>
  <code>mno</code><br>
  <code>pqr</code>  </p>
  
  <p>Any help greatfully accepted </p>
  
  <p>The code I have been working with only gives me the first column 'site'. </p>
  
  <p><code>SELECT SUBSTR(site.description,1,instr(site.description,'-',1,1)-1) AS loc</code><br>
  <code>FROM table</code>  </p>