Toad World® Forums

13.2.0.230 Code formatter formats incorrectly on conditional compilation

If conditional compilation is used, the code formatter formats incorrectly:

CREATE OR REPLACE PACKAGE BODY test
AS
   FUNCTION is_active
      RETURN BOOLEAN
   AS
      l_n   NUMBER;
   BEGIN
      $IF DBMS_DB_VERSION.ver_le_10
      $THEN
      SELECT COUNT(*) INTO l_n FROM DUAL;

      $ELSIF DBMS_DB_VERSION.ver_le_11
      $THEN
      SELECT COUNT(*) INTO l_n FROM dual;
      $ELSE
         l_n = 0;
      $END

      RETURN (l_n > 0);
   END;

   FUNCTION is_available
      RETURN BOOLEAN
   AS
   BEGIN
      $IF DBMS_DB_VERSION.ver_le_10
      $THEN
      RETURN TRUE;
   $ELSIF DBMS_DB_VERSION.ver_le_11
   $THEN
      RETURN true;
   $ELSE
      RETURN FALSE;
   $END
   END;
END;

If I've just the second function the formatting looks ok:

CREATE OR REPLACE PACKAGE BODY test
AS
   FUNCTION is_available
      RETURN BOOLEAN
   AS
   BEGIN
      $IF DBMS_DB_VERSION.ver_le_10
      $THEN
         RETURN TRUE;
      $ELSIF DBMS_DB_VERSION.ver_le_11
      $THEN
         RETURN TRUE;
      $ELSE
         RETURN FALSE;
      $END
   END;
END;

BR
Dirk

Hi Dirk,

Apparently this is due to a bug in the parser. The condition compilation statements of both 'test' functions are parsed somewhat differently. The second package behaves normally.

Case number is QP-3690.
Can't provide a due date, but it's in the pipeline now.
I'll notify via this thread whenever it gets fixed.

Thanks for reporting!
Andre