title: Oracle SQL to include null dates in where clause
body: <p>I have the following data:</p>
  
  <pre><code>id | actual_start
   1 | (null)
   2 | 03/03/2014
   3 | 27/03/2014
  </code></pre>
  
  <p>I want to be able to use a use input which will select all dates including and after the date input, but the nulls are causing me a problem.  I only want the nulls included if the user leaves the input blank.</p>
  
  <p>This is what I have:</p>
  
  <pre><code>where actual_start &gt;= nvl(to_date('&amp;start_date','dd/mm/yyyy'), to_date('01/01/2000', 'dd/mm/yyyy'))
  </code></pre>
  
  <p>This is fine for when the user does actually enter a date.  However, if the user leaves it blank, then I get this:</p>
  
  <pre><code>id | actual_start
   2 | 03/03/2014
   3 | 27/03/2014
  </code></pre>
  
  <p>which is no good.</p>
  
  <p>The other idea I had was to try:</p>
  
  <pre><code>where (actual_start &gt;= nvl(to_date('&amp;start_date','dd/mm/yyyy'), to_date('01/01/2000', 'dd/mm/yyyy'))
  or actual_start is null)
  </code></pre>
  
  <p>but this always includes the nulls - i.e. it works for the user inputting nothing, but if the user inputs 20th March, it returns:</p>
  
  <pre><code>id | actual_start
   1 | (null)
   3 | 27/03/2014
  </code></pre>
  
  <p>which isn't okay.</p>
  
  <p>Many thanks for your help.</p>