This SQL query seems to be hitting ORA 00920.
select username, count(*)
from host
where created_dt
between to_date('2012-may-23 00:00:00', 'yyyy-mon-dd hh24:mi:ss')
and to_date('2012-may-23 23:59:59', 'yyyy-mon-dd hh24:mi:ss')
GROUP BY CASE
WHEN REGEXP_LIKE(username, '^\d+$') THEN 'GRP_OTHERS'
ELSE username
END;
I don't have an Oracle DB to play with, but I imagine it could be because you select username
but don't group by it. You should be able to get around that by using a subquery:
select username, count(*)
from (select CASE
WHEN REGEXP_LIKE(username, '^\d+$') THEN 'GRP_OTHERS'
ELSE username
END as username
from host
where created_dt
between to_date('2012-may-23 00:00:00', 'yyyy-mon-dd hh24:mi:ss')
and to_date('2012-may-23 23:59:59', 'yyyy-mon-dd hh24:mi:ss')
)
GROUP BY username;