示例:
同时获取所有含有层级关系机构的名称(当前表只有一个名称,且有层级关系node/pnode),然后插入到另一张表中。
DECLARE
CURSOR ybs IS SELECT organ_code "orc",node "pnode" FROM SYS_ORGAN;
BEGIN
FOR yb IN ybs LOOP
INSERT INTO SYS_ORGAN_ORGAN(sys_id,db_key,tb_key,organ_code,manage_type,manage_organ_code,manage_organ_name,node,pnode)
SELECT sys_guid(),'0','0',yb."orc",'COMMON',organ_code,organ_name,node,pnode FROM SYS_ORGAN WHERE node LIKE (yb."pnode"||'%');
COMMIT;
END LOOP;
END;