写两个trigger好了CREATE OR REPLACE TRIGGER UPDATE_tri
before update on 号码表
for each row
begin
if :new.亲情号码 =  :old.用户号码 then
   :new.亲情号码:= 默认值
end if;
end UPDATE_tri;
/CREATE OR REPLACE TRIGGER insert_tri
before insert on 号码表
for each row
begin
if :new.亲情号码 =  :new.用户号码 then
   :new.亲情号码:= 默认值
end if;
end insert_tri;
/

解决方案 »

  1.   

    谢谢,我是按如下方式写的,帮忙看看是否有问题create or replace trigger tbl_acc_phonebind
      before  insert or update  on tbl_acc_phone_bind 
      for each row
    BEGIN
      if (:new.FLD_CALL_PHONE_NO = :new.FLD_CALLED_PHONE_NO) or substr (:new.FLD_CALLED_PHONE_NO,1,2)='13'  then
         :new.FLD_CALLED_PHONE_NO := '0111111';
      end if;END tbl_acc_phonebind;