显示具有4000多个字符的CLOB列 [英] Displaying CLOB Column with 4000+ characters

查看:75
本文介绍了显示具有4000多个字符的CLOB列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有此CLOB列,需要使用select语句显示它.

I have this CLOB column and I need to display it using a select statement.

我使用DBMS_LOB.SUBSTR将其转换为varchar2:

select DBMS_LOB.SUBSTR(T1.CLOB_COL,4000,1) CLOB_COL from T1

我的问题是我的某些CLOBS包含4000多个字符.我该如何显示...任何想法/建议?

My problem is some of my CLOBS contains more than 4000 characters. How can I display it...any idea/suggestion?

非常感谢..

推荐答案

我想您可以将这些块显示为单独的行?

I guess you could display the chunks as separate rows ?

SELECT ROWNUM as chunk_no,ID, SUBSTR (t1.clob_col, (ROWNUM-1)*4000, 4000) AS chunk
FROM t1
CONNECT BY (ROWNUM-1)*4000 <= LENGTH(t1.clob_col)

或者如果系统中Clob的最大大小受到限制,则可以对返回的文本列数进行硬编码

or if there is a constraint on the maximum size a clob could be in your system you could hard code the number of text columns returned

SELECT SUBSTR (t1.clob_col, 1, 4000) AS pt1,
       CASE WHEN LENGTH (t1.clob_col) > 4000  THEN SUBSTR (t1.clob_col, 4001, 4000) END AS pt2,
       CASE WHEN LENGTH (t1.clob_col) > 8000  THEN SUBSTR (t1.clob_col, 8001, 4000) END AS pt3,
       CASE WHEN LENGTH (t1.clob_col) > 12000 THEN SUBSTR (t1.clob_col, 1201, 4000) END AS pt4
FROM t1

这篇关于显示具有4000多个字符的CLOB列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆