日期:2014-05-16 浏览次数:20594 次
SELECT s_entity_code, NVL((SELECT '0' FROM am_sys_entity_code B WHERE I.s_entity_code=B.s_parent_code AND ROWNUM < 2),'1') S_MARK_TAIL FROM am_sys_entity_code I START WITH s_parent_code = '0' CONNECT BY s_parent_code = PRIOR s_entity_code;
UPDATE am_sys_entity_code SET S_MARK_TAIL = (SELECT NVL((SELECT '0' FROM am_sys_entity_code B WHERE I.s_entity_code=B.s_parent_code AND ROWNUM < 2),'1') S_MARK_TAIL FROM am_sys_entity_code I START WITH s_parent_code = '0' CONNECT BY s_parent_code = PRIOR s_entity_code);
UPDATE am_sys_entity_code t1 SET t1.s_mark_tail = ( select t2.s_mark_tail from ( SELECT s_entity_code, NVL((SELECT '0' FROM am_sys_entity_code B WHERE I.s_entity_code=B.s_parent_code AND ROWNUM < 2),'1') S_MARK_TAIL FROM am_sys_entity_code I START WITH s_parent_code = '0' CONNECT BY s_parent_code = PRIOR s_entity_code ) t2 where t2.s_entity_code = t1.s_entity_code );