Hello,
I'm looking to replace 1=1 in Where clause with something more efficient and elegant. I have searched but did not find what was I looking for. There are tons of questions about what 1=1 means, etc... Here's the simple query:
SELECT zip, zip_city FROM
(
SELECT 10952 zip, 'AIRMOUNTAIN' zip_city, 'RUCKLAND' zip_county, 'AR' zip_state FROM dual
UNION ALL
SELECT 10952 zip, NULL zip_city, NULL zip_county, 'AR' zip_state FROM dual
)
WHERE (zip_city = '&p_city' OR 1=1)
/
The parameter &p_city may or may not be null. Passing null to p_city will return no rows w/out 1=1. Is there any better, more efficient, elegant way to do the same please?
Thank you very much.