title: Oracle case when NOT null?
body: <p>I see a lot of queries made for Oracle using <code>CASE columnX WHEN NULL</code></p>
  
  <p>how to design query if </p>
  
  <p><code>CASE columnX WHEN NOT NULL</code> ?</p>
  
  <p>SQL developer throws an error on the query so how to make condition query using CASE... WHEN...?</p>
  
  <pre><code>WITH dates_list AS
    (SELECT TO_DATE('02-19-2018','MM-dd-yyyy') + ROWNUM - 1 AS DAY,
      rownum                                                AS row_num
    FROM dual
      CONNECT BY LEVEL &lt;= (TO_DATE('03-29-2018','MM-dd-yyyy') - TO_DATE('02-19-2018','MM-dd-yyyy')+1)
    )
  SELECT dates1.day, dates2.*, count(case dates2.day when null then 1 else 0 end) 
                over (partition by dates2.day order by dates1.day) as cnt
  FROM dates_list dates1
  LEFT JOIN
    (SELECT *
    FROM dates_list
    WHERE TO_CHAR(DAY,'D') NOT IN (7,1)
    ) dates2 ON dates1.day = dates2.day
  ORDER BY dates1.day;
  </code></pre>
  
  <p>above query gives error when I change <code>when null</code> to <code>when not null</code></p>