转换CLOB字段类型为VARCHAR2, lob类型不支持的sql语句

转自:https://blog.csdn.net/e_wsq/article/details/7561209

步骤:

1.建立一个临时varchar2字段用来保存数据

2.将clob的内容截取后更新到varchar2字段中

update table_wonder set tempcolumn = dbms_lob.substr(clobcolumn,4000);

3.drop掉clob字段

4.将临时varchar2字段改名

alter table table_wonder rename column tempcolumn to column;

另外rename语句在9.2以上版本支持,在pl/sql developer 7.0版本的command window中不支持,需要使用sqlplus。

列出lob类型不支持的sql语句

 

不支持的语句不支持的用法例子
SELECT DISTINCT

SELECT DISTINCT clobCol from...

SELECT clause           

ORDER BY

SELECT... ORDER BY clobCol

SELECT clause           

GROUP BY

SELECT avg(num) FROM...

GROUP BY clobCol

UNION, INTERSECT, MINUS           

(Note that UNION ALL works for LOBs.)

SELECT clobCol1 from tab1 UNION SELECT clobCol2 from tab2;

Join queries

SELECT... FROM... WHERE tab1.clobCol = tab2.clobCol

Index columns

CREATE INDEX clobIndx ON tab(clobCol)...

 

posted @ 2019-02-18 17:23  清风笑  阅读(1855)  评论(0编辑  收藏  举报