缓慢变化思想4

来源:互联网 发布:辅助软件定制 编辑:程序博客网 时间:2024/05/29 03:57

insert /*+ append */
  into LBI_EDM_VDF.t_e_fsi_link_mid
    (customer_id,
     link_type_id,
     biz_org_id,
     fsi_core_product_id,
     status,
     first_active_time,
     has_read_condition,
     link_account_id,
     modify_time,
     version,
     last_change_date,
     fsi_link_pk ,
     customer_status,
     STATUS_CHANGE_TIME
     )
     select /*+ parallel(link_o,4) */
    -- distinct
     link_e.customer_id,
     link_e.link_type_id,
     link_e.biz_org_id,
     link_e.fsi_core_product_id,
     link_e.status,
     link_e.first_active_time,
     link_e.has_read_condition,
     link_e.link_account_id,
     link_e.modify_time,
     0, --version              ,
     cust.load_data_ts,
     link_e.customer_id|| link_e.biz_org_id || link_e.fsi_core_product_id || link_e.first_active_time ||to_char(cust.load_data_ts, 'yyyymmddhh24miss'), --fsi_link_pk ,

     cust.status,
     cust.status_change_time
     from LBI_ODS_VDF.t_o_Customer  cust --1
     inner join
           LBI_EDM_VDF.t_e_fsi_link link_e
     on  link_e.customer_id=cust.customer_id and link_e.version=0 and cust.status<>link_e.customer_status
     where (cust.load_data_ts >= start_date and
           cust.load_data_ts < end_date)
           and not exists (select * from LBI_EDM_VDF.t_e_fsi_link_mid  tef where tef.customer_id=cust.customer_id );

     commit;

0 0
原创粉丝点击