Hi
I have an if/elsif statement nested inside another if statement:
if condition then
if v < ver then
-- do something
elsif v > ver then
-- do something else
end if;
else
-- some more stuff
end if;
v has been passed in to the stored procedure and ver has been set by a select into statement. They have sensible values (2 and 3 respectively).
However, when stepping through the code using PL/SQL Debugger, the first condition is evaluated as true and I step through the code but then somehow I end up testing the second condition and stepping through that code to. I've double checked the Oracle PL/SQL documentation which says it is OK to nest if blocks and that an if/elsif block returns control as soon as a condition is true. I have tried with brackets around my conditions, I have tried adding an empty else statement to the end (I drop into that instead of the elsif), I have double checked that my greater than and less than are around the right way - and now I'm completely confused.
Am I seeing expected behaviour, have I made a stupid mistake, or is this a bug (either in Oracle or PL/SQL Developer)?
Thanks
Alex
I have an if/elsif statement nested inside another if statement:
if condition then
if v < ver then
-- do something
elsif v > ver then
-- do something else
end if;
else
-- some more stuff
end if;
v has been passed in to the stored procedure and ver has been set by a select into statement. They have sensible values (2 and 3 respectively).
However, when stepping through the code using PL/SQL Debugger, the first condition is evaluated as true and I step through the code but then somehow I end up testing the second condition and stepping through that code to. I've double checked the Oracle PL/SQL documentation which says it is OK to nest if blocks and that an if/elsif block returns control as soon as a condition is true. I have tried with brackets around my conditions, I have tried adding an empty else statement to the end (I drop into that instead of the elsif), I have double checked that my greater than and less than are around the right way - and now I'm completely confused.
Am I seeing expected behaviour, have I made a stupid mistake, or is this a bug (either in Oracle or PL/SQL Developer)?
Thanks
Alex