代码:create or replace function Josephus(maxNumber in number,circle in number)
return number
is
finalResult number:=0;
flagValue number:=1;
begin
while flagValue<=maxNumber loop
finalResult:=(finalResult+circle-1)%flagValue+1;
flagValue:=flagValue+1;
end loop;
return(finalResult);
end Josephus;
/
错误提示信息:
LINE/COL ERROR
-------- -----------------------------------------------------------------
8/36 PLS-00103: Encountered the symbol "%" when expecting one of the
following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like
between overlaps || multiset year DAY_ member SUBMULTISET_9/1 PLS-00103: Encountered the symbol "FLAGVALUE"
9/23 PLS-00103: Encountered the symbol ";" when expecting one of the
following:
) , * & = - + < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or likeLINE/COL ERROR
-------- -----------------------------------------------------------------
between || member SUBMULTISET_
本人愚昧,不知道是什么错误,请大家帮忙解决一下!
return number
is
finalResult number:=0;
flagValue number:=1;
begin
while flagValue<=maxNumber loop
finalResult:=(finalResult+circle-1)%flagValue+1;
flagValue:=flagValue+1;
end loop;
return(finalResult);
end Josephus;
/
错误提示信息:
LINE/COL ERROR
-------- -----------------------------------------------------------------
8/36 PLS-00103: Encountered the symbol "%" when expecting one of the
following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like
between overlaps || multiset year DAY_ member SUBMULTISET_9/1 PLS-00103: Encountered the symbol "FLAGVALUE"
9/23 PLS-00103: Encountered the symbol ";" when expecting one of the
following:
) , * & = - + < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or likeLINE/COL ERROR
-------- -----------------------------------------------------------------
between || member SUBMULTISET_
本人愚昧,不知道是什么错误,请大家帮忙解决一下!
finalResult number:=0;
begin
finalResult:=Josephus(100,3);
dbms_output.put_line('the left number is:'||finalResult||'!');
end;
/
finalResult:=(finalResult+circle-1)%flagValue+1;
->
finalResult:=(finalResult+circle-1)*flagValue+1;