我在sensornowvalue这张表上建立了个行触发器
具体实现如下
declare
Cid varchar2(20);
BDate Date;
TDate Date;
begin
select CoalId into Cid from Sensor where fid = :New.fid;
BDate := :new.updatetime;
TDate := :new.updatetime+0.00035;
if :new.status = '正常' then
update Coal set COALSTAT = '正常' where coalid=Cid and
not exists ( select * from sensornowvalue where updatetime between BDate and TDate and status not like '%正常%');
end if ;
if (:new.status = '报警') or (:new.status = '超断电值') or (:new.status = '超量程') then
update Coal set COALSTAT = '报警' where coalid=Cid;
else
update Coal set COALSTAT = '异常' where coalid=Cid;
end if;
end;可是当我插入语句的时候老是报错,
错误显示如下
ORA-04091: 表 JINGSHA.SENSORNOWVALUE 发生了变化,触发器/函数不能读
ORA-06512: 在"JINGSHA.COAL_UPDATE", line 10
ORA-04088: 触发器 'JINGSHA.COAL_UPDATE' 执行过程中出错
请高手帮忙分析下
具体实现如下
declare
Cid varchar2(20);
BDate Date;
TDate Date;
begin
select CoalId into Cid from Sensor where fid = :New.fid;
BDate := :new.updatetime;
TDate := :new.updatetime+0.00035;
if :new.status = '正常' then
update Coal set COALSTAT = '正常' where coalid=Cid and
not exists ( select * from sensornowvalue where updatetime between BDate and TDate and status not like '%正常%');
end if ;
if (:new.status = '报警') or (:new.status = '超断电值') or (:new.status = '超量程') then
update Coal set COALSTAT = '报警' where coalid=Cid;
else
update Coal set COALSTAT = '异常' where coalid=Cid;
end if;
end;可是当我插入语句的时候老是报错,
错误显示如下
ORA-04091: 表 JINGSHA.SENSORNOWVALUE 发生了变化,触发器/函数不能读
ORA-06512: 在"JINGSHA.COAL_UPDATE", line 10
ORA-04088: 触发器 'JINGSHA.COAL_UPDATE' 执行过程中出错
请高手帮忙分析下
解决方案 »
- 带参function返回table类型
- 求教!ORACLE什么对象我可以select但是在ALL_OBJECTS中查询不到
- oracle导出卡壳
- ORA 00257 : archiver error. Connect internal only, until freed
- 小菜求助,关于存储过程执行的问题
- c下sql语句结果赋值问题,请大家指点,在线等,,,,谢谢!!
- oracle 注释作用 的疑问
- 求教,2个数据库的问题
- function好像不对
- 求助!alter system set statistics_level=basic时告诉我数据库不可用,怎么解决?
- 判断字符串出现几次
- 复杂的查询分页效率问题,望高手解答!
关键是在after 触发器 好像不让操作本表
从上面的代码可以看出
( select * from sensornowvalue where updatetime between BDate and TDate and status not like '%正常%');
主要就错在这,去掉就对了
http://community.csdn.net/Expert/topic/4973/4973280.xml?temp=.8997614