日期:2014-05-17 浏览次数:21028 次
INSERT INTO T_ESHOP_MONTH SELECT MON, 'qry_su', DECODE(SUM(TOTAL), 0, 0, SUM(SU) / SUM(TOTAL)), 'www' FROM (SELECT /*+parallel(t,10)*/ TO_CHAR(T.BIZ_BEGINDATE, 'YYYYMM') MON, 'qry_num' , COUNT(CASE WHEN T.BUSI_RESULT = '0' THEN 1 END) SU, COUNT(1) TOTAL FROM ES_PUB_SYSTEMLOG T WHERE T.OPER_TYPE = '0' AND T.BIZ_BEGINDATE >= TO_DATE('20120601', 'YYYYMMDD') AND T.BIZ_BEGINDATE < TO_DATE('20120701', 'YYYYMMDD') GROUP BY TO_CHAR(T.BIZ_BEGINDATE, 'YYYYMM') UNION ALL SELECT /*+parallel(t,10)*/ TO_CHAR(T.BIZ_BEGINDATE, 'YYYYMM'), 'qry_num' , COUNT(CASE WHEN T.BUSI_RESULT = '0' THEN 1 END) SU, COUNT(1) TOTAL FROM ES_PUB_SYSTEMLOGMM T WHERE T.OPER_TYPE = '0' AND T.BIZ_BEGINDATE >= TO_DATE('20120601', 'YYYYMMDD') AND T.BIZ_BEGINDATE < TO_DATE('20120701', 'YYYYMMDD') GROUP BY TO_CHAR(T.BIZ_BEGINDATE, 'YYYYMM')) GROUP BY MON; COMMIT;
INSERT INTO T_ESHOP_MONTH SELECT MON, 'qry_su', DECODE(SUM(TOTAL), 0, 0, SUM(SU) / SUM(TOTAL)), 'www' FROM (SELECT /*+parallel(t,10)*/ TO_CHAR(T.BIZ_BEGINDATE, 'YYYYMM') MON, 'qry_num' , COUNT(CASE WHEN T.BUSI_RESULT = '0' THEN 1 END) SU, COUNT(1) TOTAL FROM ES_PUB_SYSTEMLOG T WHERE T.OPER_TYPE = '0' AND T.BIZ_BEGINDATE >= V_MONTH_DATE--变量 AND T.BIZ_BEGINDATE < V_NMONTH --变量 GROUP BY TO_CHAR(T.BIZ_BEGINDATE, 'YYYYMM') UNION ALL SELECT /*+parallel(t,10)*/ TO_CHAR(T.BIZ_BEGINDATE, 'YYYYMM'), 'qry_num' , COUNT(CASE WHEN T.BUSI_RESULT = '0' THEN 1 END) SU, COUNT(1) TOTAL FROM ES_PUB_SYSTEMLOGMM T WHERE T.OPER_TYPE = '0' AND T.BIZ_BEGINDATE >= V_MONTH_DATE--变量 AND T.BIZ_BEGINDATE < V_NMONTH --变量 GROUP BY TO_CHAR(T.BIZ_BEGINDATE, 'YYYYMM')) GROUP BY MON; COMMIT;