/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2010 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

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

DECLARE

  --
  -- Local constants and variables
  --
  l_sql varchar2(32000);

BEGIN

  --
  -- Register Query Person Tags
  --
  l_sql :=
'        SELECT t.tag_id
              ,t.tag
              ,t.person_id
              ,xxas_com_sec_pkg.test_instance
                (''XXAS_DATA_PERTAG_DELETE'', t.tag_id, t.person_id) delete_allowed
              ,t.created_by
              ,xxas_util_pkg.server_to_user_timezone(t.creation_date) creation_date
        FROM   xxas_person_tags_v t
        WHERE  t.person_id = :pPersonId
        ORDER BY 2';

  xxas_com_sr_pkg.seed_query_service
    (p_service_name      => 'QueryPersonTags'
    ,p_securing_function => 'XXAS_SRV_Q_PER_TAGS_PERM'
    ,p_sql               => l_sql
    ,p_parameters        => xxas_com_sr_param_varray
                              (xxas_com_sr_param_type('pPersonId', xxas_com_sr_pkg.g_NUMBER)));

END;
/
COMMIT;
EXIT;
