首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

用触发器在insert前作检查 如不满足条件则停止insert操作

2012-09-25 
用触发器在insert前做检查 如不满足条件则停止insert操作可以使用instead of触发器,替代原先的插入操作,该

用触发器在insert前做检查 如不满足条件则停止insert操作

可以使用instead of触发器,替代原先的插入操作,该语法仅适用于视图,故为实体表建立一个一样的视图。在符合条件时,insert到实体表中,不符合条件,则不做操作:

  CREATE OR REPLACE TRIGGER TR_v_information    INSTEAD OF insert on v_information    for each row  BEGIN    if INSTR('关键字', :new.newstitle) <= 0 then      begin        insert into information          (newstitle)        values          (:new.newstitle);      end;    end if;  END TR_v_information;
?

热点排行