Oracle下,如何在两个表间创建触发器?
创建触发器实现当学生表学号改变的时候成绩表中中的学号相应修改,这个涉及到两个表,而且成绩表中一个学号对应很多学科的成绩。我试着写了下:createorreplacetri...
创建触发器实现当学生表学号改变的时候成绩表中中的学号相应修改,这个涉及到两个表,而且成绩表中一个学号对应很多学科的成绩。我试着写了下:create or replace trigger trg_upd
after update of s_no on student
referencing old as old_value
new as new_value
for each row
begin
update score set score.no=new_value where score.no=old_value;
end;
/
结果提示:Warning: Trigger created with compilation errors. 找了很多资料,没有讲到如何在两个表间建立触发器。希望高手指点! 展开
after update of s_no on student
referencing old as old_value
new as new_value
for each row
begin
update score set score.no=new_value where score.no=old_value;
end;
/
结果提示:Warning: Trigger created with compilation errors. 找了很多资料,没有讲到如何在两个表间建立触发器。希望高手指点! 展开
2个回答
展开全部
create or replace trigger trg_upd
after update on s_no on student
new as new_value
for each row
begin
update score set score.no=new_value where score.no=old_value;
update score set score.no = :new.列名 where scroe.no = :old.列名
end;
after update on s_no on student
new as new_value
for each row
begin
update score set score.no=new_value where score.no=old_value;
update score set score.no = :new.列名 where scroe.no = :old.列名
end;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询