下面的这个sql在oracle 10g上会报错, 原因是因为使用了10g上不支持的with。 本人sql很菜, 求不用with来改写下面的sql。
WITH PATH (
PATH_LEVEL,
FULL_PATH,
NODE_ID,
NAME,
PARENT_ID,
CHANGE_TIME,
PERFORMER,
REPOSITORY_ID,
NODE_TYPE,
OWNER,
DOCUMENT_TYPE_ID,
CONTENT_LENGHT,
CONTENT_TYPE,
DOC_COMMENT,
DOC_TYPE_CODE,
DOC_TYPE_NAME,
SOURCE_URL
)
AS
(
SELECT
0 AS PATH_LEVEL,
CAST( '/' + NAME AS VARCHAR(MAX)) AS FULL_PATH,
NODE_ID,
NAME,
PARENT_ID,
CHANGE_TIME,
PERFORMER,
REPOSITORY_ID,
NODE_TYPE,
OWNER,
DOCUMENT_TYPE_ID,
CONTENT_LENGHT,
CONTENT_TYPE,
DOC_COMMENT,
DOC_TYPE_CODE,
DOC_TYPE_NAME,
SOURCE_URL
FROM DOCV_NODE
WHERE PARENT_ID IS NULL
UNION ALL
SELECT
B.PATH_LEVEL + 1 AS PATH_LEVEL,
CAST( B.FULL_PATH + '/' + A.NAME AS VARCHAR(MAX)) AS FULL_PATH,
A.NODE_ID,
A.NAME,
A.PARENT_ID,
A.CHANGE_TIME,
A.PERFORMER,
A.REPOSITORY_ID,
A.NODE_TYPE,
A.OWNER,
A.DOCUMENT_TYPE_ID,
A.CONTENT_LENGHT,
A.CONTENT_TYPE,
A.DOC_COMMENT,
A.DOC_TYPE_CODE,
A.DOC_TYPE_NAME,
A.SOURCE_URL
FROM DOCV_NODE A
INNER JOIN PATH B ON B.NODE_ID = A.PARENT_ID
)
SELECT
PATH_LEVEL,
FULL_PATH,
NODE_ID,
NAME,
PARENT_ID,
CHANGE_TIME,
PERFORMER,
REPOSITORY_ID,
NODE_TYPE,
OWNER,
DOCUMENT_TYPE_ID,
CONTENT_LENGHT,
CONTENT_TYPE,
DOC_COMMENT,
DOC_TYPE_CODE,
DOC_TYPE_NAME,
SOURCE_URL
FROM PATH
------解决方案--------------------