with cur_month as
(select *
from CUST_SFM_JYCRMEPC_LIST
where mold = '302'
and create_time >=
to_date(to_char(sysdate, 'yyyy/mm') || '/01', 'yyyy-mm-dd')
and create_time <
to_date(to_char(last_day(sysdate), 'yyyy/mm/dd'), 'yyyy-mm-dd') + 1),
pre_month as
(select *
from CUST_SFM_JYCRMEPC_LIST
where mold = '302'
and create_time >=
to_date(to_char(ADD_MONTHS(sysdate, -1), 'yyyy/mm') || '/01',
'yyyy-mm-dd')
and create_time <
to_date(to_char(last_day(ADD_MONTHS(sysdate, -1)), 'yyyy/mm/dd'),
'yyyy-mm-dd') + 1)
insert /*+append parallel(t,4)*/ --月新增
into CUST_SFM_JYCRMEPC_LIST t
select PROVICE_CODE,
MDN,
imsI,
PAYMENT_MODE_CD,
PROD_INST_STATE,
STATE_TIME,
REGION,
EMDN,
EimsI,
EPAYMENT_MODE_CD,
EPROD_INST_STATE,
ESTATE_TIME,
EREGION,
302B mold,
sysdate CREATE_TIME
from (select PROVICE_CODE,
MDN,
imsI,
PAYMENT_MODE_CD,
PROD_INST_STATE,
STATE_TIME,
REGION,
EMDN,
EimsI,
EPAYMENT_MODE_CD,
EPROD_INST_STATE,
ESTATE_TIME,
EREGION
from cur_month
minus
select PROVICE_CODE,
MDN,
imsI,
PAYMENT_MODE_CD,
PROD_INST_STATE,
STATE_TIME,
REGION,
EMDN,
EimsI,
EPAYMENT_MODE_CD,
EPROD_INST_STATE,
ESTATE_TIME,
EREGION
from pre_month)
CUST_SFM_JYCRMEPC_LIST 该表示组合分区表,以CREATE_TIME
为主分区, mold 为子分区,我要实现的业务是,用 CUST_SFM_JYCRMEPC_LIST表中本月的减去上月的,求出新增的,然后将新增的插入到 CUST_SFM_JYCRMEPC_LIST 表, 请教一下有什么比较好的方法不用写的这么累呢