oracle触发器和游标问题
Createorreplacetriggert_t_emp_totalafterdeleteorinsertorupdateOnscott.empforeachrowDe...
Create or replace trigger t_t_emp_total after delete or insert or update
On scott.emp for each row
Declare
Cursor cr is select deptno from emptotal;
Row_cr cr%rowtype;
Begin
For row_cr in cr loop
Update emptotal set totalperson=(select count(ename) from scott.emp where deptno=row_cr.deptno) where deptno=row_cr.deptno;
End loop;
End;
我在触发器里面用游标这样写每次触发的时候都出错,求指点为什么? 展开
On scott.emp for each row
Declare
Cursor cr is select deptno from emptotal;
Row_cr cr%rowtype;
Begin
For row_cr in cr loop
Update emptotal set totalperson=(select count(ename) from scott.emp where deptno=row_cr.deptno) where deptno=row_cr.deptno;
End loop;
End;
我在触发器里面用游标这样写每次触发的时候都出错,求指点为什么? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询