ITPub博客

首页 > 数据库 > Oracle > 編排箱號舊資料的備份

編排箱號舊資料的備份

原创 Oracle 作者:longwansheng 时间:2009-03-31 15:57:57 0 删除 编辑

編排箱號是自主開發的,其TABLE也是自主CREATION的。故隻保留最近2年的,把2年前的或已不用的ORG的資料轉到備份TABLE中。

這樣可以提升編排箱號畫面的速度。

[@more@]

編排箱號相關的自主CREATION的TABLE有:

SUMMARY: gobo_om_ship_header_all

DETAIL: gobo_om_ship_line_all

並箱用的:gobo_ship_into_one

FRIST:

create table gobo_om_ship_line_bk2009 as
select * from gobo_om_ship_line_all
where 1=2

create table gobo_om_ship_header_bk2009 as
select * from gobo_om_ship_header_all
where 1=2


create table gobo_ship_into_one_bk2009 as
select * from gobo_ship_into_one
where 1=2

insert into gobo_om_ship_header_bk2009
select * from gobo_om_ship_header_all
where org_id in
(
2,3,4,5,6,7,8,9,10,11,12,13,58,487,179,201,202,203,483,491)

delete from gobo_om_ship_header_all
where org_id in
(
2,3,4,5,6,7,8,9,10,11,12,13,58,487,179,201,202,203,483,491)

insert into gobo_om_ship_header_bk2009
select * from gobo_om_ship_header_all a
where to_char(a.CREATION_DATE,'yyyy')<'2007'

delete gobo_om_ship_header_all a
where to_char(a.CREATION_DATE,'yyyy')<'2007'

commit

insert into gobo_om_ship_line_bk2009
select * from gobo_om_ship_line_all a
where not exists (select 1 from gobo_om_ship_header_all b
where b.ship_header_id=a.ship_header_id)

insert into gobo_ship_into_one_bk2009
select * from gobo_ship_into_one a
where not exists (select 1 from gobo_om_ship_header_all b
where b.ship_header_id=a.ship_header_id)

delete from gobo_om_ship_line_all a
where not exists (select 1 from gobo_om_ship_header_all b
where b.ship_header_id=a.ship_header_id)

delete from gobo_ship_into_one a
where not exists (select 1 from gobo_om_ship_header_all b
where b.ship_header_id=a.ship_header_id)


commit


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/92289/viewspace-1019656/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-12

  • 博文量
    162
  • 访问量
    774137