Q:

How can I modify this script to get count at every 3 minutes? 

I need to modify this query to get result for every 3 minutes interval i.e. 09:00 - 09:02 and 09:03 - 09:06
Below Query gives output count for every 1 minute: 
select TO_CHAR(ECH.CH_VALIDFROM,'mm/dd/yyyy hh24:mi'), count(1) count
from emcdu.ext_contract_history ech
where ch_status='a' and CH_VALIDFROM BETWEEN TO_DATE('21/11/2018 
09:00:00','dd/mm/yyyy hh24:mi:ss') 
AND TO_DATE ('21/11/2018 09:06:00','dd/mm/yyyy hh24:mi:ss')--and 
ECH.CHANNEL='DSP'
and ch_validfrom=(select min(CH_VALIDFROM) from emcdu.ext_contract_history 
where co_id=ech.co_id and ch_status='a')
group by channel, TO_CHAR(ECH.CH_VALIDFROM,'mm/dd/yyyy hh24:mi') ORDER BY 
TO_CHAR(ECH.CH_VALIDFROM,'mm/dd/yyyy hh24:mi') ASC;

Output for above query:
TO_CHAR(ECH.CH_VALIDFROM,'mm/dd/yyyy hh24:mi')         COUNT
11/21/2018 09:00                                       1
11/21/2018 09:01                                       2
11/21/2018 09:02                                       1
11/21/2018 09:03                                       1
11/21/2018 09:05                                       1

A:

select trunc(ECH.CH_VALIDFROM, 'mi') -  1/24/60 * mod(extract (minute from 
cast(ECH.CH_VALIDFROM as timestamp), 3), count(1) count
from emcdu.ext_contract_history ech
where ch_status='a' and CH_VALIDFROM BETWEEN TO_DATE('21/11/2018 
09:00:00','dd/mm/yyyy hh24:mi:ss') 
AND TO_DATE ('21/11/2018 09:06:00','dd/mm/yyyy hh24:mi:ss')--and 
ECH.CHANNEL='DSP'
and ch_validfrom=(select min(CH_VALIDFROM) from emcdu.ext_contract_history 
where co_id=ech.co_id and ch_status='a')
group by channel, trunc(ECH.CH_VALIDFROM, 'mi') -  1/24/60 * mod(extract (minute from 
cast(ECH.CH_VALIDFROM as timestamp)), 3) 
ORDER BY 
trunc(ECH.CH_VALIDFROM, 'mi') -  1/24/60 * mod(extract (minute from 
cast(ECH.CH_VALIDFROM as timestamp)), 3) ASC;

