第一个:
insert into d_0001
(d_000_level,
d_000_cde,
d_000_nme,
d_000_cde4,
d_000_nme4,
d_000_cde3,
d_000_nme3,
d_000_cde2,
d_000_nme2,
d_000_cde1,
d_000_nme1) select t5.c_dept_level,
t5.c_sub_dept_cde as 五级code,
t5.c_short_nme as 五级code,
decode(t5.c_dept_level, '05', t4.c_sub_dept_cde, t5.c_sub_dept_cde),
decode(t5.c_dept_level, '05', t4.c_short_nme, t5.c_short_nme),
decode
(t5.c_dept_level,
'05',
t3.c_sub_dept_cde,
'04',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode
(t5.c_dept_level,
'05',
t3.c_short_nme,
'04',
t4.c_short_nme,
t5.c_short_nme),
decode
(t5.c_dept_level,
'05',
t2.c_sub_dept_cde,
'04',
t3.c_sub_dept_cde,
'03',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode
(t5.c_dept_level,
'05',
t2.c_short_nme,
'04',
t3.c_short_nme,
'03',
t4.c_short_nme,
t5.c_short_nme),
decode
(t5.c_dept_level,
'05',
t1.c_sub_dept_cde,
'04',
t2.c_sub_dept_cde,
'03',
t3.c_sub_dept_cde,
'02',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode
(t5.c_dept_level,
'05',
t1.c_short_nme,
'04',
t2.c_short_nme,
'03',
t3.c_short_nme,
'02',
t4.c_short_nme,
t5.c_short_nme)
from (select s.c_dept_level,
s.c_sub_dept_cde,
s.c_short_nme,
c.c_sub_checkdept_cde,
s.c_is_abstarct
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t5
left join
(select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t4
on t5.c_sub_checkdept_cde = t4.c_sub_dept_cde
left join
(select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t3
on t4.c_sub_checkdept_cde = t3.c_sub_dept_cde
left join (select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t2
on t3.c_sub_checkdept_cde = t2.c_sub_dept_cde
left join (select s.c_sub_dept_cde, s.c_short_nme from t_sub_dept s) t1
on t2.c_sub_checkdept_cde = t1.c_sub_dept_cde
where t5.c_is_abstarct = 0
--commit
第二个:
insert into d_0003
(d_000_level,
d_000_cde,
d_000_nme,
d_000_cde4,
d_000_nme4,
d_000_cde3,
d_000_nme3,
d_000_cde2,
d_000_nme2,
d_000_cde1,
d_000_nme1) select t5.c_dept_level,
t5.c_sub_dept_cde as 五级code,
t5.c_short_nme as 五级code,
decode(t5.c_dept_level, '05', t4.c_sub_dept_cde, t5.c_sub_dept_cde),
decode(t5.c_dept_level, '05', t4.c_short_nme, t5.c_short_nme),
decode(t5.c_dept_level,
'05',
t3.c_sub_dept_cde,
'04',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode(t5.c_dept_level,
'05',
t3.c_short_nme,
'04',
t4.c_short_nme,
t5.c_short_nme),
decode(t5.c_dept_level,
'05',
t2.c_sub_dept_cde,
'04',
t3.c_sub_dept_cde,
'03',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode(t5.c_dept_level,
'05',
t2.c_short_nme,
'04',
t3.c_short_nme,
'03',
t4.c_short_nme,
t5.c_short_nme),
decode(t5.c_dept_level,
'05',
t1.c_sub_dept_cde,
'04',
t2.c_sub_dept_cde,
'03',
t3.c_sub_dept_cde,
'02',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode(t5.c_dept_level,
'05',
t1.c_short_nme,
'04',
t2.c_short_nme,
'03',
t3.c_short_nme,
'02',
t4.c_short_nme,
t5.c_short_nme)
from (select s.c_short_nme,
s.c_sub_dept_cde,
s.c_short_nme,
c.c_sub_checkdept_cde,
s.c_is_abstarct
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t5
left join
(select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t4
on t5.c_sub_checkdept_cde = t4.c_sub_dept_cde
left join
(select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t3
on t4.c_sub_checkdept_cde = t3.c_sub_dept_cde
left join (select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t2
on t3.c_sub_checkdept_cde = t2.c_sub_dept_cde
left join (select s.c_sub_dept_cde, s.c_short_nme from t_sub_dept s) t1
on t2.c_sub_checkdept_cde = t1.c_sub_dept_cde
where t5.c_is_abstarct = 0
一个能行一个不行?有点蒙!
insert into d_0001
(d_000_level,
d_000_cde,
d_000_nme,
d_000_cde4,
d_000_nme4,
d_000_cde3,
d_000_nme3,
d_000_cde2,
d_000_nme2,
d_000_cde1,
d_000_nme1) select t5.c_dept_level,
t5.c_sub_dept_cde as 五级code,
t5.c_short_nme as 五级code,
decode(t5.c_dept_level, '05', t4.c_sub_dept_cde, t5.c_sub_dept_cde),
decode(t5.c_dept_level, '05', t4.c_short_nme, t5.c_short_nme),
decode
(t5.c_dept_level,
'05',
t3.c_sub_dept_cde,
'04',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode
(t5.c_dept_level,
'05',
t3.c_short_nme,
'04',
t4.c_short_nme,
t5.c_short_nme),
decode
(t5.c_dept_level,
'05',
t2.c_sub_dept_cde,
'04',
t3.c_sub_dept_cde,
'03',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode
(t5.c_dept_level,
'05',
t2.c_short_nme,
'04',
t3.c_short_nme,
'03',
t4.c_short_nme,
t5.c_short_nme),
decode
(t5.c_dept_level,
'05',
t1.c_sub_dept_cde,
'04',
t2.c_sub_dept_cde,
'03',
t3.c_sub_dept_cde,
'02',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode
(t5.c_dept_level,
'05',
t1.c_short_nme,
'04',
t2.c_short_nme,
'03',
t3.c_short_nme,
'02',
t4.c_short_nme,
t5.c_short_nme)
from (select s.c_dept_level,
s.c_sub_dept_cde,
s.c_short_nme,
c.c_sub_checkdept_cde,
s.c_is_abstarct
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t5
left join
(select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t4
on t5.c_sub_checkdept_cde = t4.c_sub_dept_cde
left join
(select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t3
on t4.c_sub_checkdept_cde = t3.c_sub_dept_cde
left join (select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t2
on t3.c_sub_checkdept_cde = t2.c_sub_dept_cde
left join (select s.c_sub_dept_cde, s.c_short_nme from t_sub_dept s) t1
on t2.c_sub_checkdept_cde = t1.c_sub_dept_cde
where t5.c_is_abstarct = 0
--commit
第二个:
insert into d_0003
(d_000_level,
d_000_cde,
d_000_nme,
d_000_cde4,
d_000_nme4,
d_000_cde3,
d_000_nme3,
d_000_cde2,
d_000_nme2,
d_000_cde1,
d_000_nme1) select t5.c_dept_level,
t5.c_sub_dept_cde as 五级code,
t5.c_short_nme as 五级code,
decode(t5.c_dept_level, '05', t4.c_sub_dept_cde, t5.c_sub_dept_cde),
decode(t5.c_dept_level, '05', t4.c_short_nme, t5.c_short_nme),
decode(t5.c_dept_level,
'05',
t3.c_sub_dept_cde,
'04',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode(t5.c_dept_level,
'05',
t3.c_short_nme,
'04',
t4.c_short_nme,
t5.c_short_nme),
decode(t5.c_dept_level,
'05',
t2.c_sub_dept_cde,
'04',
t3.c_sub_dept_cde,
'03',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode(t5.c_dept_level,
'05',
t2.c_short_nme,
'04',
t3.c_short_nme,
'03',
t4.c_short_nme,
t5.c_short_nme),
decode(t5.c_dept_level,
'05',
t1.c_sub_dept_cde,
'04',
t2.c_sub_dept_cde,
'03',
t3.c_sub_dept_cde,
'02',
t4.c_sub_dept_cde,
t5.c_sub_dept_cde),
decode(t5.c_dept_level,
'05',
t1.c_short_nme,
'04',
t2.c_short_nme,
'03',
t3.c_short_nme,
'02',
t4.c_short_nme,
t5.c_short_nme)
from (select s.c_short_nme,
s.c_sub_dept_cde,
s.c_short_nme,
c.c_sub_checkdept_cde,
s.c_is_abstarct
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t5
left join
(select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t4
on t5.c_sub_checkdept_cde = t4.c_sub_dept_cde
left join
(select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t3
on t4.c_sub_checkdept_cde = t3.c_sub_dept_cde
left join (select s.c_sub_dept_cde, s.c_short_nme, c.c_sub_checkdept_cde
from t_sub_dept s
left join t_check_subdept c
on c.c_sub_dept_cde = s.c_sub_dept_cde) t2
on t3.c_sub_checkdept_cde = t2.c_sub_dept_cde
left join (select s.c_sub_dept_cde, s.c_short_nme from t_sub_dept s) t1
on t2.c_sub_checkdept_cde = t1.c_sub_dept_cde
where t5.c_is_abstarct = 0
一个能行一个不行?有点蒙!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货