I have below code provided by one of your experts to get statistics by weekly for the last 6 weeks. I need this in a daily basis now. How to do that? Please assist
DROP TABLE DQ_REPORT_DAILY purge;
CREATE TABLE DQ_REPORT_DAILY as(
SELECT table_name as TABLE_NAME,
CASE WHEN action_item like 'SOURCE_COUNT' then 'Source Row Count'
WHEN action_item like 'TARGET_COUNT' then 'Target Row Count'
WHEN action_item like 'S_MINUS_T_COUNT' then 'Source minus Target Count'
WHEN action_item like 'T_MINUS_S_COUNT' then 'Target minus Source Count'
WHEN action_item like 'BWD_COUNT' then 'Both with Differences Count' END AS ACTION_ITEM ,
FROM (SELECT run_dt,
(NEXT_DAY(TRUNC(SYSDATE - 7), 'Sunday') - NEXT_DAY(TRUNC(run_dt - 7), 'Sunday'))/7
FROM DQ_HIGH_LEVEL_COUNTS UNPIVOT (val
bwd_count))) PIVOT (MAX(val)
IN (0 curr_week,
GROUP BY table_name, action_item
ORDER BY table_name, action_item;