Null Variables in SQL?

I need to have a query such as:
select * from WHATEVERTABLE
where column1 = :variable1
and column2 = :variable2

except that either (not both) column can be null.
ie:
Column1 = 'Hello'
Column2 = NULL
When I setvariable(variable2,''), it fails (probably needs to be 'variable2 is null' according to testing in PL/SQL).
My question is:
How can I handle this query and have it pick up the records that may have a null in them? It's probably more of a SQL question. TIA, Ken
 
Try:

select * from WHATEVERTABLE
where
(column1 = :variable1 OR column1 IS NULL) AND
(column2 = :variable2 OR column2 IS NULL)
 
Back
Top