Problems with debugger in PLSQL Developer

jabarreras

Member²
Try this function:

create or replace function ppp return integer is
a integer;
begin
if true then
a:=0;
if true then
a:=1;
if true then
a:=2;
else
a:=3;
end if;
else
a:=4;
end if;
else
a:=5;
end if;

return(a);
end ppp;

The return value will be 2, and that's right, but if you follow with debugger the execution flow, you will see that the execution line goes through a:=3 and a:=4 and a:=5 although the return value is 2. If you write every if-else-end if like in Delphi:
if cond
begin
sentence
end else
begin
sentence
end
the execution flow it's correct, but you multiply by 3 the number of program lines.
Am I right?,
Is anything I am doing wrong?
 
You are right, and you are not doing anything wrong. Unfortunately the Oracle Debug API does not report the correct line number for all these "else" branches. It reports the "a := 3" statement, whereas it really evaluates the preceding "else".

It's a bit confusing, and I hope Oracle will fix this soon. Fortunately it is just a visual error.

------------------
Marco Kalter
Allround Automations
 
Back
Top