erase方法
erase(lob,amount,offset)
1用于删除一个lob中的数据,删除的方式中指定的偏移量开始,删除指定数量的字符或者字节
2改方法的使用语法如下
语法1(blob)
dbms_lob.erase(
lob in out nocopy blob,
amount in out nocopy integer,
offset in integer);
语法2(clob/noclob)
dbms_lob.erase(
lob in out nocopy clob/noclob character set any_cs,
amount in out nocopy integer,
offset in integer);
参数说明
lob:要被清除数据的lob
offset:lob的起始位置(lob的偏移量)
amount:要清除的字节或字符数
character set any_cs:lob_1 中的数据可以是任何字符集
character set dest_lob%charset:表示lob_1的字符集.
举例
测试数据
create table clob_table(
id number,
clob_column clob not null
);
--添加数据
--to_clob 将字符数据转换为clob类型
insert into clob_table values(1,to_clob('this is clob data'));
insert into clob_table values(2,to_clob('clob is here'));
select * from clob_table;
使用erase方法
create or replace procedure erase_clob
as
dest_lob clob;
amount integer:=5;
offset integer:=1;
begin
select clob_column into dest_lob from clob_table where id=1 for update;
dbms_lob.erase(dest_lob,amount,offset);
end erase_clob;
/
exec erase_clob;
select * from clob_table;