title: Use decode in sql query
body: <p>Experts...</p>
  
  <p>I'm trying to fix below simple query to include null condition.</p>
  
  <p>I can use "IS NOT NULL" in the where clause and ignore the record but again that won't be the best way. Want to fix this in right way.</p>
  
  <p>Below current decode process list all processes and replace "1234@xzy", "1234@abc" with JDBC. This decode doesn't work properly in script when there is null in the list. </p>
  
  <p>Question:
  1. Is it possible to modify current decode to replace null with NA?</p>
  
  <pre><code>Query in oracle:
  
  SELECT osuser, machine,
         DECODE (process, '1234', 'JDBC', substr(process, 1, instr(process || '@','@')-1)) "PID"
  FROM v$session
  WHERE username IS NOT NULL;
  
  Expected Result:
  =============== 
  4567    
  78960    
  4575    
  JDBC    
  JDBC    
  NA    
  9658
  
  Process list:
  =============
  4567    
  78960    
  4575    
  1234@abc    
  1234@xyz    
     (null)
  9658
  </code></pre>