select utl_raw.cast_to_varchar2(dbms_lob.substr(a,b,c)) from table;
a:要转换的那个字段;
b:截取字符串长度,为什么要取一定长度?因为这个函数最长支持2000字节
c:起始位置;
稍改动一下就可以最长取出4000个字符,oracle里字符最长是4000,如果超过4000,还是得用自定义函数或应用程序做了:
select utl_raw.cast_to_varchar2(dbms_lob.substr(a,2000,1))||utl_raw.cast_to_varchar2(dbms_lob.substr(a,2000,2001)) from table;