数据--innercode--的处理
-- 处理总行,机构级别是0的
merge into BASE_ORG t1
using BASE_ORG t2
on (t1.org_id = t2.org_id and t1.org_level = '0' )
when matched then
Update set t1.inner_code = LPAD(t1.org_code,8,'0');
-- 处理 机构级别是1的
merge into BASE_ORG t1
using BASE_ORG t2
on (t1.parent_org_id = t2.org_id and t1.org_level = '1' )
when matched then
Update set t1.inner_code = t2.inner_code|| LPAD(t1.org_code,8,'0');
-- 处理 机构级别是2 的
merge into BASE_ORG t1
using BASE_ORG t2
on (t1.parent_org_id = t2.org_id and t1.org_level = '2')
when matched then
Update set t1.inner_code = t2.inner_code|| LPAD(t1.org_code,8,'0');
--
-- 处理 机构级别是3 的
merge into BASE_ORG t1
using BASE_ORG t2
on (t1.parent_org_id = t2.org_id and t1.org_level = '3')
when matched then
Update set t1.inner_code = t2.inner_code|| LPAD(t1.org_code,8,'0');
-- 处理 机构级别是4 的
merge into BASE_ORG t1
using BASE_ORG t2
on (t1.parent_org_id = t2.org_id and t1.org_level = '4')
when matched then
Update set t1.inner_code = t2.inner_code|| LPAD(t1.org_code,8,'0');
未经作者 https://www.cnblogs.com/xin1006/ 梦相随1006 同意,不得擅自转载本文,否则后果自负