2 Replies Latest reply on Sep 20, 2016 1:28 PM by thatJeffSmith-Oracle

    [4.2EA] Syntax error message in 'Code Outline'

    ApexBine

      The code at the bottom gives me an error in the Code Outline window.

      The code was already shown as invalid in earlier versions, too, although it compiled and ran without error.

      Here's the complete code:

       

      SET SERVEROUTPUT ON
      
      
      declare 
        
        function remove_duplicates(
          p_in_string     varchar2
        , p_delimiter     varchar2
        )
          return varchar2
        is
          v_result    varchar2( 32000 );
        begin
          select listagg(
                          single_values
                        , p_delimiter
                 )
                 within group (order by single_values)
            into v_result
            from (select distinct trim(
                                        regexp_substr(
                                                       t.in_string
                                                     ,    '[^'
                                                       || p_delimiter
                                                       || ']+'
                                                     , 1
                                                     , levels.column_value
                                        )
                                  )
                                    as single_values
                    from (select p_in_string in_string
                            from dual) t
                       , table(
                                cast(
                                      multiset(
                                                select     level
                                                      from dual
                                                connect by level <=   length(
                                                                              regexp_replace(
                                                                                              t.in_string
                                                                                            ,    '[^'
                                                                                              || p_delimiter
                                                                                              || ']+'
                                                                              )
                                                                      )
                                                                    + 1
                                      ) as sys.odcinumberlist
                                )
                         ) levels);
      
      
          return v_result;
        end;
      begin
        DBMS_OUTPUT.PUT_LINE(remove_duplicates('1,2,3,2,3,4,5,3,2,2,2,4,5',','));
      end;
      

       

      Best regards,

      Sabine