oracle8.1.6 select case when exists (select 1 from acs_attributes a, acs_object_types t where t.dynamic_p = 't' and a.object_type = t.object_type and a.attribute_id = :value) then 1 else 0 end from dual select case when exists (select 1 from acs_attributes a where (a.attribute_name = :attribute or a.column_name = :attribute) and a.object_type = :object_type) then 1 else 0 end from dual