您好,登录后才能下订单哦!
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 表, 请教一下有什么比较好的方法不用写的这么累呢
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。