title: How to use subquery inside DECODE in Oracle
body: <p>I am trying to use a sub-query inside and Oracle Decode statement as shown below</p>
  
  <pre><code>RPAD(NVL(DECODE(TRIM(ST.StudentCode),'AB','CA','TM','CH',(Select InternalNumber from Address where State = SA.STATECODE) &lt;=2,'PAS', ST.StudentCode), ' '), 3, ' ')
  </code></pre>
  
  <p>when I am running this part with my original query I am getting error as "Missing right paranthesis" in the same line. What is being wrong here?</p>