问题一: 定义一个real 和int的变量怎么写?(偶是菜鸟,多帮忙)
问题二: 下面这个触发器总是无效,不知那里坏了?
begin
declare fz number;
insert into zxn.个人考核表 (emp_no) select distinct emp_no from zxn.人员表;
update zxn.个人考核表 set 出勤情况='未到' where nvl(项目编码,0)=0;
update zxn.个人考核表 set 提交=0 where nvl(项目编码,0)=0;
update zxn.个人考核表 set 计划编码=:new.计划编码 where nvl(项目编码,0)=0;
update zxn.个人考核表 set 备注=concat(:new.题目,'未到')where nvl(项目编码,0)=0;
update zxn.个人考核表 set 考核日期=:new.计划日期 where nvl(项目编码,0)=0;
update zxn.个人考核表 set 完成考核=0 where nvl(项目编码,0)=0;
update zxn.个人考核表 set 项目编码=:new.项目编码 where nvl(项目编码,0)=0;
select 项目分值 into fz from zxn.标准表 where 项目编码=:new.项目编码;
/*select count(计划编码) into jh from zxn.计划表 where 项目编码=:new.项目编码 and 完成考核=0;
update zxn.个人考核表 set 当前分值=:real(fz/jh) where 项目编码=:new.项目编码;*/
end;
问题二: 下面这个触发器总是无效,不知那里坏了?
begin
declare fz number;
insert into zxn.个人考核表 (emp_no) select distinct emp_no from zxn.人员表;
update zxn.个人考核表 set 出勤情况='未到' where nvl(项目编码,0)=0;
update zxn.个人考核表 set 提交=0 where nvl(项目编码,0)=0;
update zxn.个人考核表 set 计划编码=:new.计划编码 where nvl(项目编码,0)=0;
update zxn.个人考核表 set 备注=concat(:new.题目,'未到')where nvl(项目编码,0)=0;
update zxn.个人考核表 set 考核日期=:new.计划日期 where nvl(项目编码,0)=0;
update zxn.个人考核表 set 完成考核=0 where nvl(项目编码,0)=0;
update zxn.个人考核表 set 项目编码=:new.项目编码 where nvl(项目编码,0)=0;
select 项目分值 into fz from zxn.标准表 where 项目编码=:new.项目编码;
/*select count(计划编码) into jh from zxn.计划表 where 项目编码=:new.项目编码 and 完成考核=0;
update zxn.个人考核表 set 当前分值=:real(fz/jh) where 项目编码=:new.项目编码;*/
end;
v_real real:=0.0;
v_int int:=0;//並初始化為0
declare fz real:=0.0;
jh int:=0;
jg real:=0.0;
begin
insert into zxn.个人考核表 (emp_no) select distinct emp_no from zxn.人员表;
update zxn.个人考核表 set 出勤情况='未到',提交='0', 计划编码=:new.计划编码,
备注=concat(:new.题目,'未到'), 考核日期=:new.计划日期;/* where nvl(项目编码,0)=0;*/
update zxn.个人考核表 set 项目编码=:new.项目编码; /*where nvl(项目编码,0)=0;*/select 项目分值 into fz from zxn.标准表 where 项目编码=:new.项目编码;
select count(计划编码) into jh from zxn.计划表 where 项目编码=:new.项目编码 and 完成考核=0;
if nvl(jh,0)=0 then
jh:=1;
end if;
jg:=fz/jh;
update zxn.个人考核表 set 当前分值=jg where 项目编码=:new.项目编码;
end;
换成
where 项目编码 is null
可以用number( , )定义