sql - 运行触发器时出现变异错误
问题描述
当我尝试更新表时,我收到表正在变异错误
update flight
set captainStaffID='S0009'
where flightid='000000043';
这是触发器:
create or replace trigger trigger1
before INSERT OR UPDATE of captainStaffID,firstOfficerStaffID on flight
for each row
if UPDATING then
select count(*) into temp7
from flight
where flightid in (select ap.flightid
from ADDITIONAL_PILOT ap
where activityCode ='TR');
dbms_output.put_line('New'||:new.flightid||'OLD'||:old.flightid);
end if;
end trigger1;
/
第 1 行的错误:
ORA-04091: 表 XXXXXX.FLIGHT 正在变异,触发器/函数可能看不到它
ORA-06512: 在“XXXXXX.TRIGGER1”,第 7 行
ORA-04088: 执行触发器时出错.....TRIGGER1'
我正在使用以下更新查询来启动我的触发器
update flight set captainStaffID='S0009' where flightid='000000043';
解决方案
推荐阅读
- php - 如何计算加权排名而不是在 Laravel 中排序
- elasticsearch - Grafana:如何根据 ErrorLevel 以不同颜色显示错误日志?
- python - 使用决策树时,预期 2D 数组,得到 1D 数组
- machine-learning - 使用 Keras 提高神经网络的准确性
- google-app-engine - GCP Cloud http负载均衡器上的websocket_handshake_failed,响应为403
- ios - 正则表达式不允许在字符串 swift ios 中盯着空格
- youtube - YouTube 超级留言层的 UI 颜色是什么?
- python - import graphviz 在 jupyter notebook 中有效,但相同的代码在 Pycharm 中无效
- javascript - 标题 href 在 iframe 中打开,但 img href 不是 JS
- android - 使用 viewmodel LiveData 处理 recyclerview 中的滑动删除以进行数据存储