oracle CONNECT_BY_ROOT 在9i中的实现

SELECT *
  FROM FXYD_RWMX MX_ROOT,
       (SELECT T.*,
          --CONNECT_BY_ROOT(T.FXXX_BH) ZZBH  不支持9i
          SUBSTR(SYS_CONNECT_BY_PATH(T.FXXX_BH, '/') || '/',2,INSTR(SYS_CONNECT_BY_PATH(T.FXXX_BH, '/') || '/', '/', 1, 2) - 2) ZZBH
          FROM FXYD_RWMX T
         START WITH T.GBBZ_DM = 'N'
        CONNECT BY PRIOR T.FXXX_BH = T.GBMB_BH) MX,
        fxyd_rwpc pc
WHERE MX_ROOT.FXXX_BH = MX.ZZBH
   and mx.rwpc_bh=pc.rwpc_bh(+);


蓝色字体是在9i中用于替换10g的CONNECT_BY_ROOT功能的变通方法

 

你可能感兴趣的:(connect)