DELETE FROM DC2.OR_100 WHERE PV_USER = '340';
commit;
INSERT INTO DC2.OR_100 (PV_KEY,PV_USER,PV1)
SELECT LPAD(TO_CHAR(ROWNUM),20,0),TABLE_SELECT.* FROM (
SELECT '340',COUNT(*)
FROM
DC2_DEMO.SAM_DENPYO T001
LEFT OUTER JOIN DC2_DEMO.SAM_DAY T007 ON
 T001.DEN_DATE=T007.HIDUKE
LEFT OUTER JOIN DC2_DEMO.SAM_SYOHIN T002 ON
 T001.DEN_SYO_CD=T002.SYO_CD
WHERE
 T001.DEN_KB='2'
 AND T001.DEN_DATE BETWEEN '20100101' AND '20100110'
) TABLE_SELECT
;
commit;
EXIT;


