Tuesday, June 3, 2014

count many tables at a time

select
(select count(*) from COMM_MSG_EVNT) as COMM_MSG_EVNT,
(select count(*) from COMM_MSG_BTH) as COMM_MSG_BTH,
(select count(*) from COMM_MSG_EVNT_GRP) as COMM_MSG_EVNT_GRP,
(select count(*) from COMM_MSG_GRP) as COMM_MSG_GRP,
(select count(*) from COMM_MSG_QUEUE) as COMM_MSG_QUEUE,
(select count(*) from COMM_MSG_TRANS) as COMM_MSG_TRANS,
(select count(*) from SPL_SVC_CEVNT_TRIG_COND) as SPL_SVC_CEVNT_TRIG_COND,
(select count(*) from SPL_SVC_COMM_MSG_EVNT) as SPL_SVC_COMM_MSG_EVNT,
(select count(*) from COMM_MSG_EVNT_FLEX_ATTR) as COMM_MSG_EVNT_FLEX_ATTR
from dual;

group data in timestamp

SELECT to_char(last_upd_ts,'HH24:MI:SS'), count(*) FROM COMM_MSG_QUEUE WHERE last_upd_ts > TO_DATE('30-May-14 18:29:00', 'DD-Mon-RR HH24:MI:SS') group by to_char(last_upd_ts,'HH24:MI:SS')order by to_char(last_upd_ts,'HH24:MI:SS') asc;