I think there is a bug in PL/SQL Developer debugger or Oracle debug interface.
Look at this procedure:
create or replace procedure TEST_IF_DEBUG (
z out integer
) is
x integer;
y integer;
begin
x := 1;
y := 1;
case x
when 1 then
if (y = 1) then
z := 0;
else
z := 1;
end if;
end case;
end TEST_IF_DEBUG;
Try to execute it: you'll get 0, of course.
But now try to debug it. When you'll be on line 'z := 0' press 'step into' and... cursor goes to the line 'z := 1'!!!
I found, that this is a result of conflict 'if-then-else' and 'case-when-else' statements - there is 'else' in both.
When I put 'begin' and 'end' like this:
create or replace procedure TEST_IF_DEBUG (
z out integer
) is
x integer;
y integer;
begin
x := 1;
y := 1;
case x
when 1 then begin
if (y = 1) then
z := 0;
else
z := 1;
end if;
end;
end case;
end TEST_IF_DEBUG;
everything is fine.
Can you fix this?
Kuba
Look at this procedure:
create or replace procedure TEST_IF_DEBUG (
z out integer
) is
x integer;
y integer;
begin
x := 1;
y := 1;
case x
when 1 then
if (y = 1) then
z := 0;
else
z := 1;
end if;
end case;
end TEST_IF_DEBUG;
Try to execute it: you'll get 0, of course.
But now try to debug it. When you'll be on line 'z := 0' press 'step into' and... cursor goes to the line 'z := 1'!!!
I found, that this is a result of conflict 'if-then-else' and 'case-when-else' statements - there is 'else' in both.
When I put 'begin' and 'end' like this:
create or replace procedure TEST_IF_DEBUG (
z out integer
) is
x integer;
y integer;
begin
x := 1;
y := 1;
case x
when 1 then begin
if (y = 1) then
z := 0;
else
z := 1;
end if;
end;
end case;
end TEST_IF_DEBUG;
everything is fine.
Can you fix this?
Kuba