declare
cursor orList is select * from t_org;
topOrgID number;
begin
for org in orgList loop
begin
select t.ORG_ID into topOrgID from t_ORG t where t.UP_ORG_ID = 0
start with t.ORG_ID = org.ORG_ID connect by prior t.UP_ORG_ID = t.ORG_ID
exception
when others then
if SQLCODE = -1436 then
dbms_out_put.put_line('错误信息:'||SQLERRM || ';错误代码:'||SQLCODE || ';错误机构:'|| org.ORG_ID);
end if;
continue;
end;
end loop;
end;