Toad World® Forums

Toad Editor Navigator Conditional Define Bug

The Editor's Navigator doesn't seem to be able to handle nested conditional defines for versioning. It ends up showing nothing.

Open this simple example in the Editor, you'll see the Navigator is empty:

create or replace package P_TEST is
$IF DBMS_DB_VERSION.VER_LE_11 $THEN
$ELSIF DBMS_DB_VERSION.VER_LE_12_1 $THEN
  function Some12_1cOnlyCode return varchar2;
$ELSIF DBMS_DB_VERSION.VER_LE_12_2 $THEN
$ELSE
  function Some18cOnlyCode return varchar2;
$END
end;
/

create or replace package body P_TEST is
$IF DBMS_DB_VERSION.VER_LE_11 $THEN
$ELSIF DBMS_DB_VERSION.VER_LE_12_1 $THEN
  function Some12_1cOnlyCode return varchar2 is
  begin
    return '12.1c';
  end;
$ELSIF DBMS_DB_VERSION.VER_LE_12_2 $THEN
$ELSE
  function Some18cOnlyCode return varchar2 is
  begin
    return '18c';
  end;
$END  
end;
/

Thanks, Paul. I've logged this. The parser doesn't seem to like those empty IF/ELSIF. When I restructure that so that each path contains code then it parses OK.

1 Like

Thanks Michael, yes I suspected as much.

This approach to versioning is quite common; and unlike PL/SQL's if / else blocks, empty $IF/$ELSE/$ELSIF is syntactically allowed - even Oracle use this approach, so it would be great to get it addressed.