DELETE FROM DC2_ILS.OR_100 WHERE PV_USER = '093';
commit;
INSERT INTO DC2_ILS.OR_100 (PV_KEY,PV_USER,PV1,PV2,PV3,PV4,PV5,PV6,PV7,PV8,PV9)
SELECT LPAD(TO_CHAR(ROWNUM),20,0),TABLE_SELECT.* FROM (
SELECT '093'
 ,SUBSTRB(TO_CHAR(T003.YYYYMM),1,100) AS A001
 ,SUBSTRB(TO_CHAR(T001.BILLDate),1,100) AS A002
 ,SUBSTRB(T001.BILLNumber,1,100) AS A003
 ,SUBSTRB(T001.CUSTCode,1,100) AS A004
 ,SUBSTRB(T002.CUSTName,1,100) AS A005
 ,SUBSTRB(T001.BILLName,1,100) AS A006
 ,SUBSTRB(TO_CHAR(T001.BILLDETAILPrice),1,100) AS A007
 ,SUBSTRB(TO_CHAR(T001.TAXPrice),1,100) AS A008
 ,SUBSTRB(TO_CHAR(T001.BILLPrice),1,100) AS A009
FROM
ILS_SEIKYU.H_BILL@ILS_SEIKYU T001
LEFT OUTER JOIN ILS_SEIKYU.M_DATE@ILS_SEIKYU T003 ON
 T001.BILLDate=T003.YYYYMMDD
LEFT OUTER JOIN ILS_SEIKYU.M_CUST@ILS_SEIKYU T002 ON
 T001.CUSTCode=T002.CUSTCode
WHERE
 T003.YYYYMM BETWEEN '20250401' AND '20260331'
ORDER BY
  T003.YYYYMM
 ,T001.CUSTCode
) TABLE_SELECT
;
commit;
EXIT;


