/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2012 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 QueryLookupValues service
  --
  l_sql :=
'        SELECT hrl.lookup_type
              ,hrl.lookup_code
              ,hrl.meaning
              ,nvl(hrl.description, hrl.meaning) description
              ,hrl.enabled_flag
              ,hrl.start_date_active
              ,hrl.end_date_active
        FROM   hr_lookups hrl
        WHERE  hrl.lookup_type = :pLookupType
        AND    hrl.enabled_flag = ''Y''
        AND    :pEffectiveDate BETWEEN
               nvl(hrl.start_date_active, :pEffectiveDate) AND nvl(hrl.end_date_active, :pEffectiveDate)
        ORDER BY hrl.lookup_code ';

  xxas_com_sr_pkg.seed_query_service
    (p_service_name      => 'QueryLookupValues'
    ,p_securing_function => 'XXAS_SRV_Q_LV_PERM'
    ,p_sql               => l_sql
    ,p_parameters        => xxas_com_sr_param_varray
                              (xxas_com_sr_param_type('pLookupType'    , xxas_com_sr_pkg.g_VARCHAR2)
                              ,xxas_com_sr_param_type('pEffectiveDate' , xxas_com_sr_pkg.g_DATE)));

END;
/
COMMIT;
EXIT;
