`
javasogo
  • 浏览: 1778874 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Oracle如何对CLOB行字段来执行全文检索

阅读更多

本文讲解Oracle如何对CLOB行字段来执行全文检索。

大家知道,超过4000字的文本一般存储在CLOB中(MSQL、Sysbase是存放在Text中),在Oracle8i版本,对大字段CLOB仍然不支持在where子句直接的Like操作,如何实现对存储在CLOB字段中的内容进行Like查找呢?

下面的文章或则能给你帮助。虽然在SQL*PLUS中能实现用Select直接看到CLOB的内容,但是如何通过DBMS_LOB包实现对中文环境下的CLOB内容的读取我一直没有找到好的方法(使用Documents中提到的Samples只适用英文字符集),这极大的限制了使用第3方软件开发工作的自由度。

表结构:

create table products( 
productid number(10) not null ,
name varchar2(255) ,
description CLOB) ;
);

方法:

SELECT productid, name FROM products 
WHERE dbms_lob.instr(products.description,'some text',1,1) > 0;

下面列出了DBMS_LOB包中的过程函数:

APPEND procedure Appends the contents of 
the source LOB to the destination LOB. 

CLOSE procedure Closes a previously 
opened internal or external LOB. 

COMPARE function Compares two entire 
LOBs or parts of two LOBs. 

COPY procedure Copies all, or part, 
of the source LOB to the destination LOB. 

CREATETEMPORARY procedure Creates a temporary 
BLOB or CLOB and its corresponding index 
in the user's default temporary tablespace. 

ERASE procedure Erases all or part of a LOB. 

FILECLOSE procedure Closes the file. 

FILECLOSEALL procedure Closes all previously opened files. 

FILEEXISTS function Checks if 
the file exists on the server. 

FILEGETNAME procedure Gets the 
directory alias and file name. 

FILEISOPEN function Checks if the 
file was opened using the input BFILE locators. 

FILEOPEN procedure Opens a file. 

FREETEMPORARY procedure Frees the 
temporary BLOB or CLOB in the user's default temporary tablespace. 

GETCHUNKSIZE function Returns the amount 
of space used in the LOB chunk to store the LOB value.

GETLENGTH function Gets the length of the LOB value. 

INSTR function Returns the matching position 
of the nth occurrence of the pattern in the LOB. 

ISOPEN function Checks to see if the LOB 
was already opened using the input locator. 

ISTEMPORARY function Checks if the locator 
is pointing to a temporary LOB. 

LOADFROMFILE procedure Loads 
BFILE data into an internal LOB. 

OPEN procedure Opens a LOB 
(internal, external, or temporary) in the indicated mode. 

READ procedure Reads data from 
the LOB starting at the specified offset.

SUBSTR function Returns part of the 
LOB value starting at the specified offset. 

TRIM procedure Trims the LOB 
value to the specified shorter length. 

WRITE procedure Writes data 
to the LOB from a specified offset. 

WRITEAPPEND procedure Writes a buffer to the end of a LOB.
分享到:
评论

相关推荐

    Oracle数据库学习指南

    27.如何对CLOB行字段执行全文检索 28.如何让你的SQL运行得更快 29.如何使‘CREATE TABLE AS SELECT’能支持ORDER BY 30.删除表内重复记录的方法 31.数据库安全性策略 32.数据库的查询优化技术. 33.提高...

    Oracl技术资料(EBook)

    27.如何对CLOB行字段执行全文检索 28.如何让你的SQL运行得更快 29.如何使‘CREATE TABLE AS SELECT’能支持ORDER BY 30.删除表内重复记录的方法 31.数据库安全性策略 32.数据库的查询优化技术. 33.提高C-S...

    Oracle SQL Handler (Oracle客户端工具) V3.1

    能查看、编辑大型的文本字段(如 CLOB, LONG) <2> 运行命令 "desc tablename" 能清楚地显示表的所有列(包括名称、数据类型及长度、默认值、非空)、所有的索引、所有的约束条件(主键、唯一键、检查键、子表、外键...

    PDO取Oracle lob大字段,当数据量太大无法取出的问题的解决办法

    f_name:要查询的字段名;u_id:表的主键,查询条件;l_pos:截取的开始位置; l_amount :截取长度; CREATE OR REPLACE PROCEDURE get_clob(t_name in varchar2, f_name in varchar, u_id in integer, l_pos in ...

    oracle学习文档 笔记 全面 深刻 详细 通俗易懂 doc word格式 清晰 连接字符串

    简单来说是本身可视为电子化的文件柜——存储电子文件的处所,用户可以对文件中的数据运行新增、截取、更新、删除等操作。 常见的数据模型 1. 层次结构模型: 层次结构模型实质上是一种有根结点的定向有序树,IMS...

    Oracle事例

    <4> 对第1个字段小计,再对第2个字段小计,最后合计 select region_code,write_status,count(*) from aicbs.acc_woff_notify group by cube(region_code,write_status); ---------------------- 100 --此处有...

    oracle函数大全.doc

    ORACLE函数大全 ________________________________________ 作者:[本站编辑] 来源:[CSDN] 浏览:[ ] SQL中的单记录函数 1.ASCII 返回与指定的字符对应的十进制数; SQL> select ascii('A') A,ascii('a') a,...

    Oracle9i的init.ora参数中文说明

    说明: 使用字节或码点语义来指定新列的创建, 如 char, varchar2, clob, nchar, nvarchar2, nclob 列。各种字符集对字符都有各自的定义。在客户机和服务器上使用同一字符集时, 应以该字符集所定义的字符来衡量字符串...

    MYSQL,SQLSERVER,ORACLE常用的函数

    SQL> select instr('oracle traning','ra',1,2) instring from dual; INSTRING --------- 9 6.LENGTH 返回字符串的长度; SQL> select name,length(name),addr,length(addr),sal,length(to_char(sal)) from ....

    Spring中文帮助文档

    2.2.5. 在classpath中自动搜索组件 2.3. 面向切面编程(AOP) 2.3.1. 更加简单的AOP XML配置 2.3.2. 对@AspectJ 切面的支持 2.3.3. 对bean命名pointcut( bean name pointcut element)的支持 2.3.4. 对AspectJ装载...

    Spring API

    2.2.5. 在classpath中自动搜索组件 2.3. 面向切面编程(AOP) 2.3.1. 更加简单的AOP XML配置 2.3.2. 对@AspectJ 切面的支持 2.3.3. 对bean命名pointcut( bean name pointcut element)的支持 2.3.4. 对AspectJ装载...

Global site tag (gtag.js) - Google Analytics