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

替代触发器问题

2014-01-28 
下面这个替代触发器有问题,现现编译错误: create or replace trigger insertesview instead of insert on e

下面这个替代触发器有问题,现现编译错误:
create or replace trigger insertesview
instead of insert on esview
begin
insert into emp(xm,zc) values(:new.xm,:new.zc);
insert into salary (xm,jb,gz) values( :new.xm, : new.jb, :new.gz);
end insertesview;
/

问题出现在第二个插入语句,如删除去第二个插入语句可以通过,或者是在values中输入具体的值,如:
insert into salary(xm,jb,gz) values('aa',1,1);
把第二个插入语句改成上面的语句也可以,想请问大家,这是为什么?


------解决方法--------------------------------------------------------
insert into salary (xm,jb,gz) values( :new.xm, : new.jb, :new.gz);
改变下 :new.xm名称试试
------解决方法--------------------------------------------------------
自己看下你的esview 是怎样写的!
  还有,记得在end insertesview前加上:commit;

------解决方法--------------------------------------------------------
看下视图的定义
select text from user_views
where view_name='ESVIEW'

是否包含了那4个字段
出错具体报的是什么错

 触发器里不能有commit
自治事务除外
------解决方法--------------------------------------------------------
当建立instead of触发器时,必须指定 for each row选项吧

        

热点排行