SET VERIFY OFF
SET FEEDBACK OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

CREATE OR REPLACE VIEW xxas_per_competencies_v 
AS
 SELECT pce_party.person_id
      , perratinglevelseo.name skill_level
      , percompetenceseo.name skill_name
      , percompetenceseo.rating_scale_id
      , pce_party.attribute_category
      , 'N' competencetypeswitch
      , pce_party.type
      , percompetenceseo.date_from
      , percompetenceseo.date_to
FROM    per_competence_elements pce_party
      , per_competences_vl percompetenceseo
      , per_rating_levels_vl perratinglevelseo
WHERE   pce_party.competence_id = percompetenceseo.competence_id
AND     pce_party.proficiency_level_id = perratinglevelseo.rating_level_id (+);

BEGIN
  xxas_fnd_dictionary_pkg.add_view
   (p_application_short_name => xxas_util_pkg.app
   ,p_view_name              => 'XXAS_PER_COMPETENCIES_V'
   ,p_description            => 'Applaud Person Competencies');
END;
/
  
COMMIT;
EXIT;