我想在 Oracle DD 中创建索引(Oracle Database 11g 企业版版本 11.2.0.4.0 - 64 位生产版) 我从 Oracle 文档中了解到,为了提高查询性能,我可以在分区 LOB 列上创建索引。例如:
CREATE INDEX index_name
ON table_name (LOB_column_1, LOB_column_2, ...) LOCAL;
我已经尝试过
CREATE INDEX fullsearch_description ON T_DESCRIPTION (UPPER(text));
但我收到一个错误:
错误
r starting at line : 1 in command -
CREATE INDEX fullsearch_description ON T_DESCRIPTION (UPPER(text))
Error at Command Line : 1 Column : 55
Error report -
SQL Error: ORA-02327: cannot create index on expression with datatype LOB
02327. 00000 - "cannot create index on expression with datatype %s"
*Cause: An attempt was made to create an index on a non-indexable
expression.
*Action: Change the column datatype or do not create the index on an
expression whose datatype is one of VARRAY, nested table, object,
LOB, or REF.
最佳答案
您无法在 LOB 列上构建 B 树。
在您的case upper(lob) 返回lob
。而oracle不能使用lob建立索引。
你可以使用这样的东西。因为函数index的结果是varchar2。但我认为这个解决方案没有用。
CREATE INDEX fullsearch_description ON T_DESCRIPTION (UPPER(dbms_lob.substr(text,1,1000)));
在 lob 列上,您可以使用域索引。
Database Data Cartridge - 有关于域索引的章节。以及如何实现。 (使用可扩展索引、构建域索引、定义运算符、可扩展索引接口(interface)、可扩展优化器接口(interface))
Oracle 提供了几种域索引的实现。 Oracle Text 。
* 这些索引方法非常复杂。
关于sql - Oracle:在包含分区 LOB 列的表上创建索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40460813/