--try:declare tmp 类型;
...
begin
...
select Value into tmp From cConst Where Name='月平均工作天数';
Update cPayroll
Set OTPAY=(Select Round((Nvl(CPAYROLL.BASEPAY,0.0)/tmp/8*(Nvl(CATTEND.OT1,0.0)+Nvl(CATTEND.OT2,0.0)+Nvl(CATTEND.OT3,0.0))*3),2)
From CATTEND
Where cPayroll.Badge = CATTEND.Badge(+)
)
Where Exists .....
...
end;
...
begin
...
select Value into tmp From cConst Where Name='月平均工作天数';
Update cPayroll
Set OTPAY=(Select Round((Nvl(CPAYROLL.BASEPAY,0.0)/tmp/8*(Nvl(CATTEND.OT1,0.0)+Nvl(CATTEND.OT2,0.0)+Nvl(CATTEND.OT3,0.0))*3),2)
From CATTEND
Where cPayroll.Badge = CATTEND.Badge(+)
)
Where Exists .....
...
end;
必须是select ...into...from...where...在过程中select...from...where...只能做为子查询出现在from后面做为一个结果集。如
update tb1 set col1=(select max(col1) from (select col1 from tb2));