oracle8.1.6 select count(*) as duplicate from dual where exists (select option_id from ttracker_options where package_id = :package_id and function = :function and option_id <> :option_id and (value = :value or upper(name) = upper(:name)))