title: Decoding with SUBSTRING and INSTRING?
body: <p>I have a table which has city column having few records with state values as well-separated by comma.
  There are other records without, as well. I want to take the state values for those present into a separate field called <code>state</code>.
  How to do that? I tried the code below and it is saying "missing right parenthesis":</p>
  
  <pre><code>SELECT  DECODE(ORA_CITY,
                   INSTR(ORA_CITY,',') &gt; 0, 
                     SUBSTR(ORA_CITY, INSTR(ORA_CITY, ','), LENGTH(ORA_CITY) ) ,
                     NULL) AS STATE 
  from ADDRESS 
  </code></pre>