title: null date in search query
body: <p>this is a easy question but I can't think of how to do this at the moment.</p>
  
  <p>I have a date field in search query. The query isn't dynamic or this would be easier. I need to be able to return the records that match the date entered or if the date isn't entered then it should return all. </p>
  
  <p>This is what I have but it isn't working. It's not returning any rows, when there is criteria or when there isn't.</p>
  
  <pre><code>AND ( (table.dateField = p_dateField) 
     OR (table.dateField = table.dateField and table.dateField is null))
  </code></pre>
  
  <p>thanks in advance.</p>
  
  <p>After an hour of working with it I came up with this:</p>
  
  <pre><code>and (  
        ( p_dateField IS NOT NULL AND table.dateField = p_dateField)
           OR ( p_dateField IS NULL AND (table.dateField is null or (table.dateField is not null))
       )
  </code></pre>
  
  <p>It works for the few tests I've been able to run against it. If anyone can suggest a better method please do.</p>
  
  <p>Thanks!</p>