我有一个具有以下形式的查询的视图,当我从任何模式在本地服务器上查询它时,它可以完美地工作:
WITH dates AS (
SELECT /*+ materialize */ ... FROM ( SELECT ... FROM table@link)
UNION ALL
SELECT * FROM ( SELECT /*+ materialize */ FROM table@link )
)
SELECT ... FROM (
SELECT ... FROM (
SELECT ... FROM (
SELECT ... FROM (
SELECT ... FROM
)
) foo
LEFT OUTER JOIN (
SELECT /*+ USE_MERGE(hle dates) */ ... FROM
) bar ON conditions
)
)
UNION ALL
SELECT ... FROM (
SELECT ... FROM (
SELECT ... FROM (
SELECT ... FROM (
SELECT ... FROM
)
) foo
LEFT OUTER JOIN (
SELECT /*+ USE_MERGE(hle dates) */ ... FROM
) bar ON conditions
)
)
当我从任何其他服务器上的任何远程数据库链接运行查询时,例如SELECT * from someschema.my_view@db_link
,我得到:
ORA-00928: missing SELECT keyword
ORA-02063: preceding line from PLLDB
00928. 00000 - "missing SELECT keyword"
*Cause:
*Action:
Error at Line: 2 Column: 9
Oracle 认为第 2 行有问题。以下是前五行:
WITH dates AS (
-- Get days
SELECT /*+ materialize */
row_number() OVER (ORDER BY begin_period DESC) rn,
'D' AS interval_type,
所有其他视图都可以通过 DB 链接完美运行(一旦编辑以解决任何相关的 Oracle 错误)。
为什么这个视图可以在本地完美运行,但不能通过数据库链接?