sql语句处理BLOB

2013-04-22

BLOB二进制大对象(Binary large object) Contains arbitrary bits that represent any kind of data. 是一个可以存储二进制文件的容器。有时候需要用sql语句处理BLOB。

1、获取二进制大对象 (blob)列大小(size)

select j.id,sum(dbms_lob.getlength(j.blob2)) as v2 from conf j where id=75 group by j.id having sum(dbms_lob.getlength(j.blob2)) < 1024; 2、替换blob列 update conf set blob2=(select blob2 from conf where id='100') where id='42'; 3、查询含blob列的表 select table_name from dba_tab_columns where column_name='blob' 4、sum/min/max select max(dbms_lob.getlength(conf_v2)) from js_conf; select min(dbms_lob.getlength(conf_v2)) from js_conf; 5、将string值导入到blob列 PROPS strings PROPS_V2 blob a)、先插入个空值 update extend_conf set PROPS_V2= empty_blob() where id='8'; b)、更新 update extend_conf c set c.PROPS_V2=(select utl_raw.cast_to_raw(b.PROPS) from extend_conf b where b.id='08') where c.id='10';

分类:数据库 | 标签: |

相关日志

评论被关闭!