我有对MS-SQL和Oracle的查询,但是我想转换成Jooq。我也尝试这样的东西DSL.connectByRoot(field)
但我找不到此解决方案。主要问题是在Oracle中我们使用子句connect by prior
,但在MS-SQL中不可用。
MS-SQL查询:
WITH tempTable(ppCode, pCode) AS (
SELECT DefaultProcessDependent.PriorProcessCode, ProcessCode
FROM DefaultProcessDependent
WHERE DefaultProcessDependent.ProcessCode = ?
AND DefaultProcessDependent.FolderType = ?
UNION ALL
SELECT nplus1.PriorProcessCode, nplus1.ProcessCode
FROM DefaultProcessDependent as nplus1, tempTable
WHERE tempTable.ppCode = nplus1.ProcessCode
)
SELECT ppCode FROM tempTable
ORACLE QUERY:
Select processCode
from DefaultProcessDependent
start with DefaultProcessDependent.ProcessCode = ?
connect by prior processCode = priorProcessCode
任何人都可以帮助我...................
谢谢
最佳答案
Common table expressions will be supported with jOOQ 3.4。 jOOQ对于其他数据库也将emulate CONNECT BY,但是在jOOQ 3.4中尚不可用。