--********************************************* --*ƒf[ƒ^—L–³ƒ`ƒFƒbƒN --* --********************************************* [lselectRecords] select T2.DTS_YEAR ,T2.DTS_MONTH FROM ( select T.DTS_YEAR ,T.DTS_MONTH from M_GREAD MG ,( select DTS_YEAR ,DTS_MONTH from T_MCP where DT_MCP >= to_date('&2', 'yyyy/mm/dd') and DT_MCP <= to_date('&4', 'yyyy/mm/dd') union select DTS_YEAR ,DTS_MONTH from T_DERIVERY_PRODUCT where DT_DERIVERY_PRODUCT >= to_date('&2', 'yyyy/mm/dd') and DT_DERIVERY_PRODUCT <= to_date('&4', 'yyyy/mm/dd') union select DTS_YEAR ,DTS_MONTH from T_ADJUSTMENT where DT_ADJUSTMENT >= to_date('&2', 'yyyy/mm/dd') and DT_ADJUSTMENT <= to_date('&4', 'yyyy/mm/dd') ) T GROUP BY T.DTS_YEAR, T.DTS_MONTH order by T.DTS_YEAR, T.DTS_MONTH ) T2 where T2.DTS_YEAR is not null and T2.DTS_MONTH is not null --********************************************* --*‘€‹ΖŽžŠΤE‚o‚l‰^“]ŽžŠΤ --* --********************************************* [lDB_TIME_PM] select PRC_GET_TIMES('&1', '&2', '01', '&6', '&7', '&8') --********************************************* --* Žw’θŠϊŠΤ•ͺ‚Μƒf[ƒ^‚πŽζ“Ύ --* --********************************************* [lselectRecords2] SELECT MCP2.DTS_YEAR ,MCP2.CD_GREAD ,MCP2.AVE_MOIST ,MCP2.DIV_WEIGHT_DRIED ,trunc((SUM(coalesce(MCP2.GANSUI1, 0)) / 1000) + 0.5) GANSUI1 ,trunc((SUM(coalesce(MCP2.GANSUI2, 0)) / 1000) + 0.5) GANSUI2 ,trunc((SUM(coalesce(MCP2.GANSUI3, 0)) / 1000) + 0.5) GANSUI3 ,trunc((SUM(coalesce(MCP2.GANSUI4, 0)) / 1000) + 0.5) GANSUI4 ,trunc((SUM(coalesce(MCP2.GANSUI5, 0)) / 1000) + 0.5) GANSUI5 ,trunc((SUM(coalesce(MCP2.GANSUI6, 0)) / 1000) + 0.5) GANSUI6 ,trunc((SUM(coalesce(MCP2.GANSUI7, 0)) / 1000) + 0.5) GANSUI7 ,trunc((SUM(coalesce(MCP2.GANSUI8, 0)) / 1000) + 0.5) GANSUI8 ,trunc((SUM(coalesce(MCP2.GANSUI9, 0)) / 1000) + 0.5) GANSUI9 ,trunc((SUM(coalesce(MCP2.GANSUI10, 0)) / 1000) + 0.5) GANSUI10 ,trunc((SUM(coalesce(MCP2.GANSUI11, 0)) / 1000) + 0.5) GANSUI11 ,trunc((SUM(coalesce(MCP2.GANSUI12, 0)) / 1000) + 0.5) GANSUI12 ,trunc((SUM(coalesce(MCP2.FUKAN1, 0)) / 1000) + 0.5) FUKAN1 ,trunc((SUM(coalesce(MCP2.FUKAN2, 0)) / 1000) + 0.5) FUKAN2 ,trunc((SUM(coalesce(MCP2.FUKAN3, 0)) / 1000) + 0.5) FUKAN3 ,trunc((SUM(coalesce(MCP2.FUKAN4, 0)) / 1000) + 0.5) FUKAN4 ,trunc((SUM(coalesce(MCP2.FUKAN5, 0)) / 1000) + 0.5) FUKAN5 ,trunc((SUM(coalesce(MCP2.FUKAN6, 0)) / 1000) + 0.5) FUKAN6 ,trunc((SUM(coalesce(MCP2.FUKAN7, 0)) / 1000) + 0.5) FUKAN7 ,trunc((SUM(coalesce(MCP2.FUKAN8, 0)) / 1000) + 0.5) FUKAN8 ,trunc((SUM(coalesce(MCP2.FUKAN9, 0)) / 1000) + 0.5) FUKAN9 ,trunc((SUM(coalesce(MCP2.FUKAN10, 0)) / 1000) + 0.5) FUKAN10 ,trunc((SUM(coalesce(MCP2.FUKAN11, 0)) / 1000) + 0.5) FUKAN11 ,trunc((SUM(coalesce(MCP2.FUKAN12, 0)) / 1000) + 0.5) FUKAN12 ,SUM(coalesce(MCP2.SUIBUN1, 0)) SUIBUN1 ,SUM(coalesce(MCP2.SUIBUN2, 0)) SUIBUN2 ,SUM(coalesce(MCP2.SUIBUN3, 0)) SUIBUN3 ,SUM(coalesce(MCP2.SUIBUN4, 0)) SUIBUN4 ,SUM(coalesce(MCP2.SUIBUN5, 0)) SUIBUN5 ,SUM(coalesce(MCP2.SUIBUN6, 0)) SUIBUN6 ,SUM(coalesce(MCP2.SUIBUN7, 0)) SUIBUN7 ,SUM(coalesce(MCP2.SUIBUN8, 0)) SUIBUN8 ,SUM(coalesce(MCP2.SUIBUN9, 0)) SUIBUN9 ,SUM(coalesce(MCP2.SUIBUN10, 0)) SUIBUN10 ,SUM(coalesce(MCP2.SUIBUN11, 0)) SUIBUN11 ,SUM(coalesce(MCP2.SUIBUN12, 0)) SUIBUN12 ,trunc((SUM(coalesce(MCP2.TANAFU1, 0)) / 1000) + 0.5) TANAFU1 ,trunc((SUM(coalesce(MCP2.TANAFU2, 0)) / 1000) + 0.5) TANAFU2 ,trunc((SUM(coalesce(MCP2.TANAFU3, 0)) / 1000) + 0.5) TANAFU3 ,trunc((SUM(coalesce(MCP2.TANAFU4, 0)) / 1000) + 0.5) TANAFU4 ,trunc((SUM(coalesce(MCP2.TANAFU5, 0)) / 1000) + 0.5) TANAFU5 ,trunc((SUM(coalesce(MCP2.TANAFU6, 0)) / 1000) + 0.5) TANAFU6 ,trunc((SUM(coalesce(MCP2.TANAFU7, 0)) / 1000) + 0.5) TANAFU7 ,trunc((SUM(coalesce(MCP2.TANAFU8, 0)) / 1000) + 0.5) TANAFU8 ,trunc((SUM(coalesce(MCP2.TANAFU9, 0)) / 1000) + 0.5) TANAFU9 ,trunc((SUM(coalesce(MCP2.TANAFU10, 0)) / 1000) + 0.5) TANAFU10 ,trunc((SUM(coalesce(MCP2.TANAFU11, 0)) / 1000) + 0.5) TANAFU11 ,trunc((SUM(coalesce(MCP2.TANAFU12, 0)) / 1000) + 0.5) TANAFU12 FROM ( select TDP.DTS_YEAR ,TDP.CD_GREAD ,MG.AVE_MOIST ,MD.DIV_WEIGHT_DRIED ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 01 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI1 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 02 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI2 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 03 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI3 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 04 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI4 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 05 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI5 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 06 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI6 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 07 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI7 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 08 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI8 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 09 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI9 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 10 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI10 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 11 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI11 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 12 THEN WEIGHT_MOIST ELSE 0 END), 0) GANSUI12 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 01 THEN WEIGHT_DRY ELSE 0 END), 0) fukan1 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 02 THEN WEIGHT_DRY ELSE 0 END), 0) fukan2 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 03 THEN WEIGHT_DRY ELSE 0 END), 0) fukan3 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 04 THEN WEIGHT_DRY ELSE 0 END), 0) fukan4 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 05 THEN WEIGHT_DRY ELSE 0 END), 0) fukan5 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 06 THEN WEIGHT_DRY ELSE 0 END), 0) fukan6 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 07 THEN WEIGHT_DRY ELSE 0 END), 0) fukan7 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 08 THEN WEIGHT_DRY ELSE 0 END), 0) fukan8 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 09 THEN WEIGHT_DRY ELSE 0 END), 0) fukan9 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 10 THEN WEIGHT_DRY ELSE 0 END), 0) fukan10 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 11 THEN WEIGHT_DRY ELSE 0 END), 0) fukan11 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 12 THEN WEIGHT_DRY ELSE 0 END), 0) fukan12 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 01 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN1 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 02 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN2 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 03 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN3 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 04 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN4 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 05 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN5 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 06 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN6 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 07 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN7 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 08 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN8 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 09 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN9 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 10 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN10 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 11 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN11 ,coalesce(sum(CASE WHEN TDP.DTS_MONTH = 12 THEN RATIO_MOIST ELSE 0 END), 0) SUIBUN12 ,0 tanafu1 ,0 tanafu2 ,0 tanafu3 ,0 tanafu4 ,0 tanafu5 ,0 tanafu6 ,0 tanafu7 ,0 tanafu8 ,0 tanafu9 ,0 tanafu10 ,0 tanafu11 ,0 tanafu12 from T_DERIVERY_PRODUCT TDP , M_GREAD MG ,( SELECT CD_DERIVERY ,CD_CUSTOMER ,DIV_WEIGHT_DRIED FROM M_DERIVERY WHERE DT_START <= TO_DATE('&5', 'yyyy/mm/dd') AND DT_END >= TO_DATE('&5', 'yyyy/mm/dd') ) MD where DT_DERIVERY_PRODUCT >= TO_DATE('&5', 'yyyy/mm/dd') AND DT_DERIVERY_PRODUCT <= TO_DATE('&9', 'yyyy/mm/dd') AND (('&3' = '') OR (TDP.CD_GREAD = ('&3' ::text) ::numeric)) AND TDP.CD_GREAD = MG.CD_GRADE AND TDP.CD_DERIVERY = MD.CD_DERIVERY AND TDP.FLG_DELETE = 0 group by TDP.DTS_YEAR , TDP.CD_GREAD, MG.AVE_MOIST, MD.DIV_WEIGHT_DRIED UNION select TA.DTS_YEAR ,TA.CD_GREAD ,MG.AVE_MOIST ,MD.DIV_WEIGHT_DRIED ,0 GANSUI1 ,0 GANSUI2 ,0 GANSUI3 ,0 GANSUI4 ,0 GANSUI5 ,0 GANSUI6 ,0 GANSUI7 ,0 GANSUI8 ,0 GANSUI9 ,0 GANSUI10 ,0 GANSUI11 ,0 GANSUI12 ,0 fukan1 ,0 fukan2 ,0 fukan3 ,0 fukan4 ,0 fukan5 ,0 fukan6 ,0 fukan7 ,0 fukan8 ,0 fukan9 ,0 fukan10 ,0 fukan11 ,0 fukan12 ,0 SUIBUN1 ,0 SUIBUN2 ,0 SUIBUN3 ,0 SUIBUN4 ,0 SUIBUN5 ,0 SUIBUN6 ,0 SUIBUN7 ,0 SUIBUN8 ,0 SUIBUN9 ,0 SUIBUN10 ,0 SUIBUN11 ,0 SUIBUN12 ,sum(CASE WHEN TA.DTS_MONTH = 01 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu1 ,sum(CASE WHEN TA.DTS_MONTH = 02 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu2 ,sum(CASE WHEN TA.DTS_MONTH = 03 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu3 ,sum(CASE WHEN TA.DTS_MONTH = 04 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu4 ,sum(CASE WHEN TA.DTS_MONTH = 05 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu5 ,sum(CASE WHEN TA.DTS_MONTH = 06 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu6 ,sum(CASE WHEN TA.DTS_MONTH = 07 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu7 ,sum(CASE WHEN TA.DTS_MONTH = 08 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu8 ,sum(CASE WHEN TA.DTS_MONTH = 09 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu9 ,sum(CASE WHEN TA.DTS_MONTH = 10 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu10 ,sum(CASE WHEN TA.DTS_MONTH = 11 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu11 ,sum(CASE WHEN TA.DTS_MONTH = 12 THEN coalesce(TA.WEIGHT, 0) ELSE 0 END) tanafu12 from T_ADJUSTMENT TA , M_GREAD MG ,( SELECT CD_DERIVERY ,CD_CUSTOMER ,DIV_WEIGHT_DRIED FROM M_DERIVERY WHERE DT_START <= TO_DATE('&5', 'yyyy/mm/dd') AND DT_END >= TO_DATE('&5', 'yyyy/mm/dd') ) MD where DT_ADJUSTMENT >= TO_DATE('&5', 'yyyy/mm/dd') AND DT_ADJUSTMENT <= TO_DATE('&9', 'yyyy/mm/dd') AND (('&3' = '') OR (TA.CD_GREAD = ('&3' ::text) ::numeric)) AND TA.CD_GREAD = MG.CD_GRADE AND TA.CD_DERIVERY = MD.CD_DERIVERY AND TA.FLG_DELETE = 0 AND DIV_WP_PRODUCT = 1 group by TA.DTS_YEAR , TA.CD_GREAD, MG.AVE_MOIST, MD.DIV_WEIGHT_DRIED ) MCP2 GROUP BY MCP2.DTS_YEAR, MCP2.CD_GREAD, MCP2.AVE_MOIST, MCP2.DIV_WEIGHT_DRIED --********************************************* --*ŒΜŽ†“Š“όΓή°ΐ’Šo‚r‚p‚k --* --********************************************* [lselectRecords3] SELECT DTS_YEAR ,CD_GRADE_PRODUCT ,trunc((SUM(HARIJURYOU1) / 1000) + 0.5) HARIJURYOU1 ,trunc((SUM(HARIJURYOU2) / 1000) + 0.5) HARIJURYOU2 ,trunc((SUM(HARIJURYOU3) / 1000) + 0.5) HARIJURYOU3 ,trunc((SUM(HARIJURYOU4) / 1000) + 0.5) HARIJURYOU4 ,trunc((SUM(HARIJURYOU5) / 1000) + 0.5) HARIJURYOU5 ,trunc((SUM(HARIJURYOU6) / 1000) + 0.5) HARIJURYOU6 ,trunc((SUM(HARIJURYOU7) / 1000) + 0.5) HARIJURYOU7 ,trunc((SUM(HARIJURYOU8) / 1000) + 0.5) HARIJURYOU8 ,trunc((SUM(HARIJURYOU9) / 1000) + 0.5) HARIJURYOU9 ,trunc((SUM(HARIJURYOU10) / 1000) + 0.5) HARIJURYOU10 ,trunc((SUM(HARIJURYOU11) / 1000) + 0.5) HARIJURYOU11 ,trunc((SUM(HARIJURYOU12) / 1000) + 0.5) HARIJURYOU12 ,trunc((SUM(TANAWP1) / 1000) + 0.5) TANAWP1 ,trunc((SUM(TANAWP2) / 1000) + 0.5) TANAWP2 ,trunc((SUM(TANAWP3) / 1000) + 0.5) TANAWP3 ,trunc((SUM(TANAWP4) / 1000) + 0.5) TANAWP4 ,trunc((SUM(TANAWP5) / 1000) + 0.5) TANAWP5 ,trunc((SUM(TANAWP6) / 1000) + 0.5) TANAWP6 ,trunc((SUM(TANAWP7) / 1000) + 0.5) TANAWP7 ,trunc((SUM(TANAWP8) / 1000) + 0.5) TANAWP8 ,trunc((SUM(TANAWP9) / 1000) + 0.5) TANAWP9 ,trunc((SUM(TANAWP10) / 1000) + 0.5) TANAWP10 ,trunc((SUM(TANAWP11) / 1000) + 0.5) TANAWP11 ,trunc((SUM(TANAWP12) / 1000) + 0.5) TANAWP12 FROM ( SELECT DTS_YEAR ,CD_GRADE_PRODUCT ,coalesce(sum(CASE WHEN DTS_MONTH = 01 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU1 ,coalesce(sum(CASE WHEN DTS_MONTH = 02 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU2 ,coalesce(sum(CASE WHEN DTS_MONTH = 03 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU3 ,coalesce(sum(CASE WHEN DTS_MONTH = 04 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU4 ,coalesce(sum(CASE WHEN DTS_MONTH = 05 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU5 ,coalesce(sum(CASE WHEN DTS_MONTH = 06 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU6 ,coalesce(sum(CASE WHEN DTS_MONTH = 07 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU7 ,coalesce(sum(CASE WHEN DTS_MONTH = 08 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU8 ,coalesce(sum(CASE WHEN DTS_MONTH = 09 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU9 ,coalesce(sum(CASE WHEN DTS_MONTH = 10 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU10 ,coalesce(sum(CASE WHEN DTS_MONTH = 11 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU11 ,coalesce(sum(CASE WHEN DTS_MONTH = 12 THEN WEIGHT_WP ELSE 0 END), 0) HARIJURYOU12 ,0 TANAWP1 ,0 TANAWP2 ,0 TANAWP3 ,0 TANAWP4 ,0 TANAWP5 ,0 TANAWP6 ,0 TANAWP7 ,0 TANAWP8 ,0 TANAWP9 ,0 TANAWP10 ,0 TANAWP11 ,0 TANAWP12 FROM T_SHIP_WP TSW WHERE DT_SHIPSLIP >= TO_DATE('&5', 'yyyy/mm/dd') AND DT_SHIPSLIP <= TO_DATE('&9', 'yyyy/mm/dd') AND (('&3' = '') OR (CD_GRADE_PRODUCT = ('&3' ::text) ::numeric)) AND FLG_DELETE = 0 GROUP BY DTS_YEAR , CD_GRADE_PRODUCT union SELECT DTS_YEAR ,CD_GREAD CD_GRADE_PRODUCT ,0 HARIJURYOU1 ,0 HARIJURYOU2 ,0 HARIJURYOU3 ,0 HARIJURYOU4 ,0 HARIJURYOU5 ,0 HARIJURYOU6 ,0 HARIJURYOU7 ,0 HARIJURYOU8 ,0 HARIJURYOU9 ,0 HARIJURYOU10 ,0 HARIJURYOU11 ,0 HARIJURYOU12 ,coalesce(sum(CASE WHEN DTS_MONTH = 01 THEN WEIGHT ELSE 0 END), 0) TANAWP1 ,coalesce(sum(CASE WHEN DTS_MONTH = 02 THEN WEIGHT ELSE 0 END), 0) TANAWP2 ,coalesce(sum(CASE WHEN DTS_MONTH = 03 THEN WEIGHT ELSE 0 END), 0) TANAWP3 ,coalesce(sum(CASE WHEN DTS_MONTH = 04 THEN WEIGHT ELSE 0 END), 0) TANAWP4 ,coalesce(sum(CASE WHEN DTS_MONTH = 05 THEN WEIGHT ELSE 0 END), 0) TANAWP5 ,coalesce(sum(CASE WHEN DTS_MONTH = 06 THEN WEIGHT ELSE 0 END), 0) TANAWP6 ,coalesce(sum(CASE WHEN DTS_MONTH = 07 THEN WEIGHT ELSE 0 END), 0) TANAWP7 ,coalesce(sum(CASE WHEN DTS_MONTH = 08 THEN WEIGHT ELSE 0 END), 0) TANAWP8 ,coalesce(sum(CASE WHEN DTS_MONTH = 09 THEN WEIGHT ELSE 0 END), 0) TANAWP9 ,coalesce(sum(CASE WHEN DTS_MONTH = 10 THEN WEIGHT ELSE 0 END), 0) TANAWP10 ,coalesce(sum(CASE WHEN DTS_MONTH = 11 THEN WEIGHT ELSE 0 END), 0) TANAWP11 ,coalesce(sum(CASE WHEN DTS_MONTH = 12 THEN WEIGHT ELSE 0 END), 0) TANAWP12 FROM T_ADJUSTMENT WHERE DT_ADJUSTMENT >= TO_DATE('&5', 'yyyy/mm/dd') AND DT_ADJUSTMENT <= TO_DATE('&9', 'yyyy/mm/dd') AND (('&3' = '') OR (CD_GREAD = ('&3' ::text) ::numeric)) AND FLG_DELETE = 0 AND DIV_WP_PRODUCT = 0 GROUP BY DTS_YEAR, CD_GREAD ) alias132 GROUP BY DTS_YEAR, CD_GRADE_PRODUCT --********************************************* --*‚l‚b‚o‘€‹ΖΓή°ΐ’Šo‚r‚p‚k --* --********************************************* [lselectRecords4] SELECT DTS_YEAR ,CD_GREAD ,coalesce(sum(CASE WHEN DTS_MONTH = 01 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI1 ,coalesce(sum(CASE WHEN DTS_MONTH = 02 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI2 ,coalesce(sum(CASE WHEN DTS_MONTH = 03 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI3 ,coalesce(sum(CASE WHEN DTS_MONTH = 04 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI4 ,coalesce(sum(CASE WHEN DTS_MONTH = 05 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI5 ,coalesce(sum(CASE WHEN DTS_MONTH = 06 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI6 ,coalesce(sum(CASE WHEN DTS_MONTH = 07 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI7 ,coalesce(sum(CASE WHEN DTS_MONTH = 08 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI8 ,coalesce(sum(CASE WHEN DTS_MONTH = 09 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI9 ,coalesce(sum(CASE WHEN DTS_MONTH = 10 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI10 ,coalesce(sum(CASE WHEN DTS_MONTH = 11 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI11 ,coalesce(sum(CASE WHEN DTS_MONTH = 12 THEN TIME_OPERATE_PLAN ELSE 0 END), 0) SOUGYOUYOTEI12 ,coalesce(sum(CASE WHEN DTS_MONTH = 01 THEN TIME_OPERATE ELSE 0 END), 0) PM1 ,coalesce(sum(CASE WHEN DTS_MONTH = 02 THEN TIME_OPERATE ELSE 0 END), 0) PM2 ,coalesce(sum(CASE WHEN DTS_MONTH = 03 THEN TIME_OPERATE ELSE 0 END), 0) PM3 ,coalesce(sum(CASE WHEN DTS_MONTH = 04 THEN TIME_OPERATE ELSE 0 END), 0) PM4 ,coalesce(sum(CASE WHEN DTS_MONTH = 05 THEN TIME_OPERATE ELSE 0 END), 0) PM5 ,coalesce(sum(CASE WHEN DTS_MONTH = 06 THEN TIME_OPERATE ELSE 0 END), 0) PM6 ,coalesce(sum(CASE WHEN DTS_MONTH = 07 THEN TIME_OPERATE ELSE 0 END), 0) PM7 ,coalesce(sum(CASE WHEN DTS_MONTH = 08 THEN TIME_OPERATE ELSE 0 END), 0) PM8 ,coalesce(sum(CASE WHEN DTS_MONTH = 09 THEN TIME_OPERATE ELSE 0 END), 0) PM9 ,coalesce(sum(CASE WHEN DTS_MONTH = 10 THEN TIME_OPERATE ELSE 0 END), 0) PM10 ,coalesce(sum(CASE WHEN DTS_MONTH = 11 THEN TIME_OPERATE ELSE 0 END), 0) PM11 ,coalesce(sum(CASE WHEN DTS_MONTH = 12 THEN TIME_OPERATE ELSE 0 END), 0) PM12 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 01 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI1 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 02 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI2 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 03 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI3 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 04 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI4 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 05 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI5 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 06 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI6 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 07 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI7 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 08 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI8 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 09 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI9 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 10 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI10 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 11 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI11 ,trunc((coalesce(sum(CASE WHEN DTS_MONTH = 12 THEN WEIGHT_PLAN ELSE 0 END), 0) / 1000) + 0.5) SEISANYOTEI12 ,coalesce(sum(CASE WHEN DTS_MONTH = 01 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU1 ,coalesce(sum(CASE WHEN DTS_MONTH = 02 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU2 ,coalesce(sum(CASE WHEN DTS_MONTH = 03 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU3 ,coalesce(sum(CASE WHEN DTS_MONTH = 04 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU4 ,coalesce(sum(CASE WHEN DTS_MONTH = 05 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU5 ,coalesce(sum(CASE WHEN DTS_MONTH = 06 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU6 ,coalesce(sum(CASE WHEN DTS_MONTH = 07 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU7 ,coalesce(sum(CASE WHEN DTS_MONTH = 08 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU8 ,coalesce(sum(CASE WHEN DTS_MONTH = 09 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU9 ,coalesce(sum(CASE WHEN DTS_MONTH = 10 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU10 ,coalesce(sum(CASE WHEN DTS_MONTH = 11 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU11 ,coalesce(sum(CASE WHEN DTS_MONTH = 12 THEN TIME_PM_WORK ELSE 0 END), 0) SOUGYOU12 FROM T_MCP WHERE DT_MCP >= TO_DATE('&5', 'yyyy/mm/dd') and DT_MCP <= TO_DATE('&9', 'yyyy/mm/dd') AND (('&3' = '') OR (CD_GREAD = ('&3' ::text) ::numeric)) AND FLG_DELETE = 0 GROUP BY DTS_YEAR , CD_GREAD