Oracle 将Long 类型 转换为 Clob类型 方法

--Test convert Long to Blob;

create table long_test(

field1 Long;

);

/

alter table long_test add field2 Blob;

/

alter table long_test modify field1 Clob;

/

declare

c clob;

cursor cv_clob is 

select field1 from long_test;

begin

    open cv_clob;

    LOOP 

      FETCH cv_clob

      INTO c;

      update long_test set field2 = c2b(c);

    EXIT WHEN cv_clob%NOTFOUND;  

    END LOOP;

    commit;

end;

/

alter table long_test drop column field1;

/

alter table long_test rename column field2 to field1;

你可能感兴趣的:(Long转换为Blob)