text: declare
  
  l_compile_all    constant boolean := case when upper(substr('${compile_all}'   , 1, 1)) in ('F', 'N', '0', '$') then false else true end;
  l_reuse_settings constant boolean := case when upper(substr('${reuse_settings}', 1, 1)) in ('F', 'N', '0', '$') then false else true end;
  
  -- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  --
  -- This procedure must be in sync with the same procedure in ../full/R__14.PACKAGE_BODY.CFG_INSTALL_PKG.sql
  --
  -- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  procedure compile_objects
  ( p_compile_all in boolean
  , p_reuse_settings in boolean
  )
  is
    l_message varchar2(2047) := null; -- one less than the maximum for raise_application_error because a newline is added later on
  begin
    execute immediate 'purge recyclebin'; -- do not recompile recyclebin triggers
  
    if p_compile_all
    then
      declare
        l_found pls_integer;
      begin
        select  1
        into    l_found
        from    user_objects o
        where   o.object_type = 'PACKAGE'
        and     o.object_name = $$PLSQL_UNIT
        ;
        raise_application_error(-20000, 'We can not recompile all objects if this package (' || $$PLSQL_UNIT || ') is part of the objects to recompile.');
      exception
        when no_data_found
        then
          null; -- OK: we will not recompile this $$PLSQL_UNIT
      end;
    end if;
  
    dbms_utility.compile_schema(schema => user, compile_all => p_compile_all, reuse_settings => p_reuse_settings);
    
    for r_error in
    ( select  e.*
      from    ( select  e.*, rank() over (partition by e.owner order by e.name, e.type) as rnk
                from    all_errors e
                where   e.owner = user and e.attribute = 'ERROR' -- ignore WARNINGS
                order by
                        e.owner, e.name, e.type, e.line, e.position
              ) e
      where   e.rnk = 1 -- show only the first object which contains errors
    )
    loop
      begin
        if l_message is null
        then
          l_message := r_error.type||' '||r_error.owner||'.'||r_error.name||' has errors:'||chr(10)||chr(10);
        end if;
        l_message := l_message || 'at (' || r_error.line || ',' || r_error.position || '): ' || r_error.text || chr(10);
      exception
        when value_error
        then exit;
      end;
    end loop;
    if l_message is not null
    then
      raise_application_error(-20000, l_message || chr(10));
    end if;
  end compile_objects;
  
  begin
    -- use Flyway placeholders (can be overriden by -Dflyway.placeholders.compile_all=X and -Dflyway.placeholders.reuse_settingsm=X)
    compile_objects(p_compile_all => l_compile_all, p_reuse_settings => l_reuse_settings);
  end;
  /
  