title: Using NVL for multiple columns - Oracle SQL
body: <p>Good morning my beloved sql wizards and sorcerers,</p>
  
  <p>I am wanting to substitute on 3 columns of data across 3 tables. Currently I am using the NVL function, however that is restricted to two columns. </p>
  
  <p>See below for an example:</p>
  
  <pre><code>    SELECT ccc.case_id,
             NVL (ccvl.descr, ccc.char)) char_val
  
                 FROM case_char ccc, char_value ccvl, lookup_value lval1
                WHERE   
                      ccvl.descr(+) = ccc.value
                      AND ccc.value = lval1.descr (+)
                      AND ccc.case_id IN ('123'))
  
  
  
       case_char table
       case_id|char |value
         123  |email| work_email
         124  |issue| tim_ 
  
  
  
       char_value table
       char  | descr
  work_email | complaint mail
      tim_   | timeliness
  
  
      lookup_value table
      descr  | descrlong
   work_email| xxx@blah.com
  </code></pre>
  
  <p>Essentially what I am trying to do is if there exists a match for case_char.value with lookup_value.descr then display it, if not, then if there exists a match with case_char.value and char_value.char then display it.</p>
  
  <p>I am just trying to return the description for 'issue'from the char_value table, but for 'email' I want to return the descrlong from the lookup_value table (all under the same alias 'char_val').</p>
  
  <p>So my question is, how do I achieve this keeping in mind that I want them to appear under the same alias.</p>
  
  <p>Let me know if you require any further information.</p>
  
  <p>Thanks guys</p>