oracle8.1.6 select case when count(*) = 0 then 0 else 1 end from news_items_approved where publish_date < sysdate and archive_date < sysdate and package_id = :package_id select case when count(*) = 0 then 0 else 1 end from news_items_approved where publish_date < sysdate and (archive_date is null or archive_date > sysdate) and package_id = :package_id publish_date < sysdate and (archive_date is null or archive_date > sysdate) publish_date < sysdate and archive_date < sysdate