select to_char(first_time, ‘RRRRMMDDHH24’),
COUNT (CASE WHEN TO_NUMBER(TO_CHAR(FIRST_time, ‘MI’)) <= 30 THEN 1 ELSE NULL END) COUNT1,
COUNT (CASE WHEN TO_NUMBER(TO_CHAR(FIRST_time, ‘MI’)) > 30 THEN 1 ELSE NULL END) COUNT2
FROM V$LOG_HISTORY
GROUP BY to_char(first_time, ‘RRRRMMDDHH24’)
order by 1
/
TO_CHAR(FI COUNT1 COUNT2
———- ———- ———-
2010020906 3 1
2010020907 3 1
2010020908 3 1
2010020909 3 1
2010020910 3 1
2010020911 3 1
2010020912 3 1
2010020913 3 1
2010020914 3 1
2010020915 3 1
2010020916 4 2
TO_CHAR(FI COUNT1 COUNT2
———- ———- ———-
2010020917 3 1
2010020918 3 1
2010020919 1 0