ORA-64140: missing chaining XMLTABLE for VIRTUAL column in the index ORACLE 报错 故障修复 远程处理


文档解释

ORA-64140: missing chaining XMLTABLE for VIRTUAL column in the index

Cause: An attempt was made to create an XML index with VIRTUAL column but without required chaining XMLTABLE.

Action: Specify a chaining XMLTABLE after VIRTUAL column.

ORA-64140:XMLTABLE中缺少虚拟列的索引

官方解释

此错误消息指示没有在XMLTABLE中使用VIRTUAL COLUMN中定义的索引,这是与使用XMLTABLE相关的索引不一致性错误。

常见案例

下面是一个未正确抓取索引以对应VIRTUAL COLUMN的示例:

CREATE TABLE vc_table

(

col1 VARCHAR2(10),

col2 VARCHAR2(20)

);

CREATE INDEX vc_index ON vc_table(col1, UPPER(col2) );

SELECT x.* FROM

XMLTABLE(‘…’

PASSING xmltag

COLUMNS a VARCHAR2(10) PATH ‘a’,

b VARCHAR2(20) PATH ‘b’

) x

WHERE x.a = ‘foo’ AND UPPER(x.b) = ‘BAR’;

一般处理方法及步骤

要解决此问题,请把你的查询修改为正确使用索引的方式。

上面的示例对应下面的查询:

SELECT x.* FROM

XMLTABLE(‘…’

PASSING xmltag

COLUMNS a VARCHAR2(10) PATH ‘a’,

b VARCHAR2(20) PATH ‘b’

, UPPER(b) VIRTUAL COLUMN

) x

WHERE x.a = ‘foo’ AND x.UPPER_B = ‘BAR’;