View Single Post
  #4 (permalink)  
Old December 14th, 2011, 09:13 AM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I'm no expert in Oracle but in SQL Server's version of SQL you'd have something like:
Code:
SELECT * FROM MyTable
WHERE
(DateField = @StartDate OR @StartDate IS NULL)
AND (TextField = @TextInput OR @TextInput IS NULL)
This way you compare if the two inputs (which start with the @ sign) exist and not if they are left as NULL.
__________________
Joe
http://joe.fawcett.name/