请大侠帮忙,该改改这个触发器使他有作用,目的是更新修改jyc_person
是,将他更新的tel,handset合并后,将更新到jyc_loandi的handset,如果jyc_loandi的handset字段为空的话。
create or replace trigger aufer_jyc_person_update
after update on jyc_person
--referencing old as old_value
-- new as new_value
for each row
declare
handsetchar VARCHAR2(10);
begin
handsetchar:='';
if :old.handset<>'' then
handsetchar:=:new.handset||',';
end if;
if :old.tel<>'' then
handsetchar:=handsetchar||:old.tel||',';
end if;
if handsetchar<>'' then
update jyc_loandi
set handset=SUBSTR(handsetchar,1,LENGTH(handsetchar)-1)
where peid=:old.peid andhandset='';
end if;
end aufer_jyc_person_update;
是,将他更新的tel,handset合并后,将更新到jyc_loandi的handset,如果jyc_loandi的handset字段为空的话。
create or replace trigger aufer_jyc_person_update
after update on jyc_person
--referencing old as old_value
-- new as new_value
for each row
declare
handsetchar VARCHAR2(10);
begin
handsetchar:='';
if :old.handset<>'' then
handsetchar:=:new.handset||',';
end if;
if :old.tel<>'' then
handsetchar:=handsetchar||:old.tel||',';
end if;
if handsetchar<>'' then
update jyc_loandi
set handset=SUBSTR(handsetchar,1,LENGTH(handsetchar)-1)
where peid=:old.peid andhandset='';
end if;
end aufer_jyc_person_update;
应该用is not null
oracle没有空字符串,只有null,null值不能比较,字符串连接时null相当于空串