对外接口表

INSERT INTO zte.zte_aol_fa_retirement_temp@erp_link
  (asset_number,
   retirement_date,
   operator,
   retirement_type,
   trans_operte_flag,
   error_log)
  SELECT TRIM(l.asset_no) asset_no,
         sysdate,
         SUBSTR(TRIM(d.created_by), 0, 20) created_by,
         SUBSTR(TRIM(d.segment2), 0, 50) segment2,
         'E',
         'test'
    FROM aol_asset_modifylog l, aol_asset_stop_detail d,zte.zte_aol_fa_retirement_temp@erp_link k
   WHERE l.segment3 = d.base_bill_no
     AND l.asset_no = d.asset_no
     AND l.segment2 = 'scrap'
     AND l.segment15 = '9'
     AND l.account_state = 'COPYTOERP'
     and l.asset_no <> k.asset_number
select * from zte.zte_aol_fa_retirement_temp@erp_link k where k.asset_number  not in (
 SELECT TRIM(l.asset_no) asset_no  FROM aol_asset_modifylog l, aol_asset_stop_detail d  WHERE l.segment3 = d.base_bill_no
     AND l.asset_no = d.asset_no
     AND l.segment2 = 'scrap'
     AND l.segment15 = '9'
     AND l.account_state = 'COPYTOERP'
     and l.asset_no  in (select asset_number from zte.zte_aol_fa_retirement_temp@erp_link k )
    
     update zte.zte_aol_fa_retirement_temp@erp_link j set j.trans_operte_flag='E'where j.retirement_date=to_date('2009-4-27','yyyy-mm-dd')


合并两列数据

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
insert into aol.aol_asset_tmp_four2
  (asset_no, enterprise_code, enterprise_name, dept_name, dept_code)
  select a.asset_no,
         a.enterprise_code,
         a.enterprise_name,
         a.dept_name dept,
         a.dept_code
    from aol.aol_asset_tmp_four a;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 INSERT INTO zte.zte_aol_fa_retirement_temp@erp_link
   (asset_number,
    retirement_date,
    operator,
    retirement_type,
    trans_operte_flag,
    error_log)
   SELECT TRIM(l.asset_no) asset_no,
          sysdate,
          SUBSTR(TRIM(d.created_by), 0, 20) created_by,
          SUBSTR(TRIM(d.segment2), 0, 50) segment2,
          'E',
          'test'
     FROM aol_asset_modifylog l, aol_asset_stop_detail d
    WHERE l.segment3 = d.base_bill_no
      AND l.asset_no = d.asset_no
      AND l.segment2 = 'scrap'
      AND l.segment15 = '9'
      AND l.account_state = 'COPYTOERP'

你可能感兴趣的:(J#)