且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Oracle中将CLOB转换为BLOB?

更新时间:2022-01-02 22:04:28

这样的代码将执行最少的编码:

Code like this will perform minimal recoding:

create or replace function clob2blob(AClob CLOB) return BLOB is
  Result BLOB;
  o1 integer;
  o2 integer;
  c integer;
  w integer;
begin
  o1 := 1;
  o2 := 1;
  c := 0;
  w := 0;
  DBMS_LOB.CreateTemporary(Result, true);
  DBMS_LOB.ConvertToBlob(Result, AClob, length(AClob), o1, o2, 0, c, w);
  return(Result);
end clob2blob;
/

但是CLOB无法在没有任何编码(如Base64)的情况下正确包含所有图像数据

But CLOB can not properly contain all Image data without any encoding like Base64