erase方法+erase(lob,amount,offset)+使用erase方法

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;

这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值