title: Oracle Case Statement if null select a different table
body: <p>I am selecting some data where we have a set of peoples names, and also a list of preferred names, which may or may not be null. I am checking to see if the preferred first name is null, if it is use the a different table for the name. I understand I need to use a case statement for this, any insight or tips would be appreciated.</p>
  
  <p>Example:</p>
  
  <pre><code>SELECT sp1.PREF_FIRST_NAME
  CASE  
  WHEN sp1.PREF_FIRST_NAME is null 
  THEN s1.FIRST_NAME as "Pref_Name"
  ELSE  sp1.PREF_FIRST_NAME as "Pref_Name"
  END
  FROM TABLE1 sp1,TABLE2 s1
  </code></pre>