oracle触发器的问题

柱子89 2012-08-10 05:38:29
create or replace trigger testTr
before insert
on result_test
for each row

declare value number;
direction number;
begin
select cg.value into alarmvalue from cgtest cg where cg.id=3;

if(:new.state >= value) then
begin

delete from eatest ea where ea.id=:new.id and ea.flag=0;

select ps.direction into direction from pstest ps where ps.id = :new.id;

insert into eatest(id,time,type,direction,status,description,flag)
values
(:new.id,:new.time,3,direction,:new.state,'test',0);

end;
end if;

end;
我觉的这个红色的地方使用有错误,这样使用正确吗?
...全文
109 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ershihaidao 2012-08-13
  • 打赏
  • 举报
回复
我感觉没问题。调试一下,如果有错误反馈上来是什么错误。大家帮你看
pengpeng409 2012-08-13
  • 打赏
  • 举报
回复
不懂。。。。。
柱子89 2012-08-13
  • 打赏
  • 举报
回复
不是说delete中没有new,只有old吗
人生无悔 2012-08-10
  • 打赏
  • 举报
回复
我感觉没错误,试下就清楚了

17,089

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧