declare
maxl number;
idnew number;
begin
for t in (select id from t2) loop
select max(level) ll into maxl from t1 start with id=t.id connect by prior pid=id;
select id into idnew from
(select level ll, id,pid from t1 start with id=t.id connect by prior pid=id)
where ll=maxl-1;
update t2 set id=idnew where id=t.id;
end loop;
commit;
end;[@more@]
maxl number;
idnew number;
begin
for t in (select id from t2) loop
select max(level) ll into maxl from t1 start with id=t.id connect by prior pid=id;
select id into idnew from
(select level ll, id,pid from t1 start with id=t.id connect by prior pid=id)
where ll=maxl-1;
update t2 set id=idnew where id=t.id;
end loop;
commit;
end;[@more@]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7312700/viewspace-1002636/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7312700/viewspace-1002636/