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 表, 请教一下有什么比较好的方法不用写的这么累呢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。