Count duplicate value
1.
SELECT REG_NO, COUNT(REG_NO)
FROM OP_APPOINTMENT
WHERE APPOINT_DATE BETWEEN NVL(:P_DT1,APPOINT_DATE) AND NVL(:P_DT2,APPOINT_DATE)
GROUP BY REG_NO
HAVING ( COUNT(REG_NO) > 1 )
2.
select POLICE_BP_NO, count(POLICE_BP_NO) from op_registration where rel_id='0'
group by POLICE_BP_NO
having count(POLICE_BP_NO)>1
3. Union all
select sum(onetime) one,sum(app_multipl) multiple,sum(app_dependent) dep,sum(app_self) self,apdate
from
((select count(app_onetime) onetime, 0 as app_multipl, 0 as app_dependent,...