title: Concatenate with string but exclude when null
body: <p>Oracle v11</p>
  
  <p>Exclude a string in a Concat when the value is NULL?</p>
  
  <p>Work
  Query:</p>
  
  <pre><code>Select 
   *
   LastName || ',' || FirstName AS Last_First_Name
  
   --I've tried using NVL &amp; NVL2
   --NVL(LastName || ',' || FirstName,'') AS Last_First_Name2
   FROM TableA
  </code></pre>
  
  <p>TableA</p>
  
  <pre><code>LastName   FirstName  ID
   Smith       Ann      1
                        2
  </code></pre>
  
  <p>Output I'm getting</p>
  
  <pre><code>LastName FirstName ID   LastName_FirstName
   Smith       Ann    1    Smith,Ann
                      2    ,
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>LastName FirstName ID   LastName_FirstName
   Smith       Ann    1    Smith,Ann
                      2      
  </code></pre>