oracle 触发器,blob clob字段不成功解决方案

创建临时表,保存数据

create or replace trigger TRI_pass_area
after update or delete or insert on pass_area
for each row
declare
integrity_error exception;
errno integer;
errmsg char(200);
begin
if updating then
update pass_area@ks_forbid_link
set area_name = :NEW.area_name,
class = :NEW.class,
type = :NEW.type,
facility_list = :NEW.facility_list,
points = :NEW.points,
description = :NEW.description,
auto = :NEW.auto,
enterprise_id = :NEW.enterprise_id,
status = :NEW.status
where area_id = :OLD.area_id;
elsif deleting then
delete from pass_area@zjg_forbid_link where area_id = :OLD.area_id;
elsif inserting then
insert into pass_area_temp
(area_id,
area_name,
class,
type,
facility_list,
points,
description,
auto,
enterprise_id,
status)
values
(:NEW.area_id,
:NEW.area_name,
:NEW.class,
:NEW.type,
:NEW.facility_list,
:NEW.points,
:NEW.description,
:NEW.auto,
:NEW.enterprise_id,
:NEW.status);
insert into pass_area@ks_forbid_link select * from pass_area_temp where area_id = :NEW.area_id;
end if;
exception
when integrity_error then
raise_application_error(errno, errmsg);
end;

 

测试:

insert into pass_area(area_id,area_name,class,type,points) values(12123222,'aaa',1,1,c2b(to_clob('test')));

说明:c2b是一个函数,clob转成blob的函数,博客里面有https://blog.csdn.net/qjm201000/article/details/100118685

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值