2 Replies Latest reply on Apr 19, 2019 4:31 PM by 2772914

    Formatter and Code Outline error in CASE statement.

    2772914

      Hi,

       

      I am using Sql Developer 19.1.0.094.

       

      I have a case statement that is causing trouble for the formatter and code outline.

       

      select case when "a" < "b" then "b" else "a" end from dual;
      
      --Here, "a" is a static value and "b" is a case statement.
      

       

      for example,

       

      select case when 2 < case when 1=1 then 1 else 0 end
             then case when 1=1 then 1 else 0 end
             else 2
             end
      from dual;
      

       

      I get a "Syntax error. Partially recognized rules" when I try to format this query.

       

      In the code outline, it shows the "Syntax error; Partial parse tree:" error. And I don't see subprograms sections beyond this line in the outline popup.

       

      You can try this pacakge:

       

      create or replace package test_pkg as
          procedure p1;
          procedure p2;
      end;
      /
      create or replace package body test_pkg
      as
          procedure p1
              as 
              begin
              dbms_output.put_line (case when 2 < case when 1=1 then 1 else 0 end
                                     then case when 1=1 then 1 else 0 end
                                     else 2
                                     end
                     ); 
          end;
          procedure p2
              as
              begin
              null;
              end;
      end test_pkg;
      /
      

       

      Disabling the semantic tool info doesn't help.

       

      If I swap my if else values, it seems to work.

       

      for example, this does not cause any problems for code outline

       

      select case when 2 < case when 1=1 then 1 else 0 end
             then 2
             else case when 1=1 then 1 else 0 end
             end
      from dual;
      

       

      Any help is appreciated. Thanks!