您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。