下面为验证代码:
declare
num1 number;
num2 number:=&4;
out1 number:=1;
out2 number:=3;
i number;
erro exception;
begin
i:=1;
while i<=10000 loop
i:=i+1;
num1:=i;
SELECT remainder(num1, num2) into out1
FROM duaL;
select num1 - (case
when substr(col, instr(col, '.')) = '.5' and
mod(floor(col), 2) = 0 then
floor(col)
else
round(col)
end) * num2 into out2
from (select num1 / num2 col from dual);
if nvl(out1,'1')<>nvl(out2,'2') then
raise erro;
end if;
end loop;
DBMS_OUTPUT.put_line ( num1||'-'||num2||'-'||out1||'-'||out2);
exception
when erro then
raise_application_error(-20000,num1||'-'||num2||'-'||out1||'-'||out2,TRUE);
RAISE;
when others then
raise_application_error(-20000,num1||'-'||num2||'-'||out1||'-'||out2,TRUE);
RAISE;
end;