title: Select default value if result is null
body: <p>Hello friends I have been using this query to select some two fields on my Java application.</p>
  
  <pre><code>select distinct STU_LEVEL, STU_STREAM from STUDENT_MASTER_TABLE where STATUS_YEAR !=ACADEMIC_YEAR
  </code></pre>
  
  <p>Problem is if there is no data, the application is throwing a null pointer Exception. I need it such that if the fields are Null, then they are defaulted to 0. I have tried this with Coalesce but I can't seem to get it like:</p>
  
  <pre><code>select coalesce(distinct (STU_LEVEL,0),  (STU_STREAM, '0')) from STUDENT_MASTER_TABLE where STATUS_YEAR !=ACADEMIC_YEAR
  </code></pre>
  
  <p>Please help.</p>