文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ORACLE 和 SQL 分别实现递归的方法

ORACLE 和 SQL 分别实现递归的方法

时间:2010-12-10  来源:钻石眼泪

Sql的CTE

 

 

WITH EMPLOYEE_LIST AS (

SELECT A.EMP_NO AS APPROVER_ID,1 AS SEQUENCE_NO,'实际需求方/DEPT MANAGER' AS APPROVER_ROLE,A.SUPERVISOR

 FROM AM_EMPLOYEE A,FIN_APPROVE_MODEL B

 WHERE B.FORM_TYPE='CT_BI' AND B.OU_CODE=@OU_CODE

AND A.EMP_NO= B.EMPLOYEE_NUMBER

AND A.EMP_NO=@EMP_NO

UNION ALL

SELECT A.EMP_NO AS APPROVER_ID,1 AS SEQUENCE_NO,'实际需求方/DEPT MANAGER' AS APPROVER_ROLE,A.SUPERVISOR

FROM AM_EMPLOYEE A,FIN_APPROVE_MODEL B,EMPLOYEE_LIST C

 WHERE B.FORM_TYPE='CT_BI' AND B.OU_CODE=@OU_CODE

AND A.EMP_NO= B.EMPLOYEE_NUMBER

AND A.EMP_NO=C.SUPERVISOR

AND B.MAX_AMOUNT<=@MAX_AMOUNT

)

SELECT APPROVER_ID,SEQUENCE_NO,APPROVER_ROLE FROM EMPLOYEE_LIST 

 

 

ORACLE

 

 

SELECT A.CATEGORY_ID, B.CATEGORY_NAME

  FROM (SELECT A.CATEGORY_ID

          FROM DCS_CATEGORY A

         START WITH A.CATEGORY_ID = 1000124

        CONNECT BY PRIOR A.CATEGORY_PID = A.CATEGORY_ID) A,

       DCS_CATEGORY_TL B

 WHERE A.CATEGORY_ID = B.CATEGORY_ID

   AND B.LANGUAGE = 'zh-CN'

 

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载