oracle8.1.6
select c.category_id,
(select case when count(*) = 0 then 0 else 1 end from dual
where exists (select 1 from category_object_map
where category_id = c.category_id)) as used_p
from categories c, category_temp t
where c.category_id = t.category_id