触发更新Clob错误 [英] Trigger updating clob error
问题描述
尝试创建将更新clob rtrim
的a>字段硬返回应用程序投入的位置.
无法获取应用程序代码,因此我看不到其他方法可以通过触发器对数据进行可能需要的更改.
Trying to create a trigger that will update a clob field to rtrim
hard returns the application is tossing in.
Cannot get to the application code, so I see no other way to make potentially needed changes to the data with a trigger.
并非总是添加退货.
此代码引发错误....
This code is throwing error ....
预期的数据类型不一致会导致阻塞.
Inconsistent data type expected got clob.
我认为声明该字段可以避免此问题...但是没有...
I thought declaring the field would avoid the issue... but no...
任何帮助或建议都将不胜感激.
Any help or suggestions greatly appreciated.
CREATE OR REPLACE TRIGGER AI_master_set
AFTER INSERT ON base1
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
master_set CLOB;
BEGIN
UPDATE base1
set master_set= rtrim(master_set,chr(00))
WHERE master_set = :new.master_set;
:new.master_set:= master_set;
END;
推荐答案
Based on the horse with no name, and on Oracle (11g) compound trigger not updating CLOB data field, this should simply work:
CREATE OR REPLACE TRIGGER AI_master_set
before INSERT ON base1
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
tmp_master_set CLOB;
BEGIN
tmp_master_set := rtrim(:new.master_set,chr(00));
:new.master_set:= tmp_master_set ;
END;
/
希望有帮助.
这篇关于触发更新Clob错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!