/*车间初始化*/
delete work_shop where site in ('1120', '1140', '1160');
insert into imes.work_shop
(site, work_shop, description)
select site, work_center, description
from wipdba.time_workcenter@jymes x
where wc_category = 'LEVEL4'
and site in ('1120', '1140', '1160')
order by 1, 2;
/*产线数据导入*/
delete imes.work_center where site in ('1120', '1140', '1160');
insert into imes.work_center
(site, work_center, description, cost_center, work_shop)
with a as /*产线车间关系*/
(select x.work_center, work_center_or_resource_gbo
from time_workcenter@jymes x, work_center_member@jymes wcm
where wc_category = 'LEVEL4'
and wcm.work_center_bo = x.handle),
b as
(select site
,x.work_center
,description
,nvl(value, x.work_center) costcenter_code
,nvl(a.work_center, 'NULL') work_shop
from wipdba.time_workcenter@jymes x, custom_fields@jymes cf, a
where wc_category = 'LEVEL3'
and cf.handle(+) = x.handle
and "ATTRIBUTE"(+) = 'COSTCENTER_CODE'
and x.handle = a.work_center_or_resource_gbo(+)
order by 1, 2)
select * from b where site in ('1120', '1140', '1160');
标签:1140,1160,center,1120,work,site From: https://www.cnblogs.com/hlm750908/p/17511287.html