Welcome 微信登录

首页 / 数据库 / MySQL / Oracle 中两张表同步的触发器

/*创建表A*/
create table A_ybl (   y                   INTEGER                         not null,   b            VARCHAR(30)                     not null,   l            VARCHAR(20)                     not null
   );
/*创建表A的备份表*/create table A_ybl2 (   y                   INTEGER                         not null,   b            VARCHAR(30)                     not null,   l            VARCHAR(20)                     not null
   );
create or replace trigger test
after insert or update or delete on  A_ybl for each rowdeclare
error_exception exception,
errno integer,
errmsg  char(20),
dummy integer,
found boolean;begin
if inserting  then
    insert into  A_ybl2 values(:NEW.y,:NEW.B,:NEW.l);
 elsif updating then
        update A_ybl2 set y=:NEW.y,
                   b=:NEW.b,
                   l=:NEW.l
               where id:=:OLD.y;
      elsif deleting  then
          delete from A_ybl2  where y=:old.id;
 end if;
 
 exception
 
 when error_exception   then
 raise_application_error(errno,errmsg);
 end;               Oracle调用Java外部存储过程Oracle 快速将某用户所有table的select权限授权给另一用户相关资讯      Oracle教程 
  • Oracle中纯数字的varchar2类型和  (07/29/2015 07:20:43)
  • Oracle教程:Oracle中查看DBLink密  (07/29/2015 07:16:55)
  • [Oracle] SQL*Loader 详细使用教程  (08/11/2013 21:30:36)
  • Oracle教程:Oracle中kill死锁进程  (07/29/2015 07:18:28)
  • Oracle教程:ORA-25153 临时表空间  (07/29/2015 07:13:37)
  • Oracle教程之管理安全和资源  (04/08/2013 11:39:32)
本文评论 查看全部评论 (0)
表情: 姓名: 字数