DBA Data[Home] [Help]

APPS.BEN_PURGE_BCKDT_VOIDED SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 38

procedure person_selection_rule
		 (p_person_id                in  Number
                 ,p_business_group_id        in  Number
                 ,p_person_selection_rule_id in  Number
                 ,p_effective_date           in  Date
                 ,p_input1                   in  varchar2 default null    -- Bug 5331889
                 ,p_input1_value             in  varchar2 default null
		 ,p_return                   in out nocopy varchar2
                 ,p_err_message              in out nocopy varchar2 ) as

  Cursor c1 is
      Select assignment_id
        From per_assignments_f paf
       Where paf.person_id = p_person_id
         and paf.assignment_type <> 'C'
         And paf.primary_flag = 'Y'
         And paf.business_group_id = p_business_group_id
         And p_effective_date between paf.effective_start_date and paf.effective_end_date ;
Line: 57

  l_proc   	       varchar2(80) := g_package||'.person_selection_rule';
Line: 81

                      (p_formula_id        => p_person_selection_rule_id
                      ,p_effective_date    => p_effective_date
                      ,p_business_group_id => p_business_group_id
                      ,p_assignment_id     => l_assignment_id
                      ,p_param1            => 'BEN_IV_PERSON_ID'          -- Bug 5331889
                      ,p_param1_value      => to_char(p_person_id)
                      ,p_param2            => p_input1
                      ,p_param2_value      => p_input1_value);
Line: 109

      fnd_message.set_token('RL','person_selection_rule_id :'||p_person_selection_rule_id);
Line: 118

End person_selection_rule;
Line: 135

            ,p_person_selection_rule_id in number	 default hr_api.g_number
            ,p_audit_log                in varchar2	 default hr_api.g_varchar2
            ,p_from_ocrd_date           in     date default null
            ,p_to_ocrd_date             in     date default null
            ,p_life_evt_typ_cd          in     varchar2 default null
            ,p_bckt_stat_cd             in     varchar2 default 'VOIDD'
            ,p_delete_life_evt          in     varchar2 default 'N'
            ,p_delete_ptnl_life_evt     in     varchar2 default 'N'
            ) is
  l_proc        varchar2(80) := g_package||'.print_parameters';
Line: 160

  If (nvl(p_person_selection_rule_id,-1) <> hr_api.g_number) then
      ben_batch_utils.write(p_text => 'Person Selection Rule      :'||
                      benutils.iftrue
                           (p_expression => p_person_selection_rule_id is null
                           ,p_true       => 'None'
                           ,p_false      => p_person_selection_rule_id));
Line: 243

  ben_batch_utils.write(p_text => 'Delete Life Events         :'||
                             hr_general.decode_lookup('YES_NO',p_delete_life_evt));
Line: 265

            ,p_Person_selection_rl     in     number     default NULL
            ,p_life_event_id            in     number   default null
            ,p_from_ocrd_date           in     varchar2 default null
            ,p_to_ocrd_date             in     varchar2
            ,p_organization_id          in     number   default null
            ,p_location_id              in     number   default null
            ,p_benfts_grp_id            in     number   default null
            ,p_legal_entity_id          in     number   default null
            ,p_payroll_id               in     number   default null
            ,p_life_evt_typ_cd          in     varchar2 default null
            ,p_bckt_stat_cd             in     varchar2 default 'VOIDD'
            ,p_audit_log_flag           in     varchar2 default 'N'
            ,p_delete_life_evt          in     varchar2
            ,p_delete_ptnl_life_evt     in     varchar2
            )
  is
  --
  -- Local variable declaration.
  --
  l_effective_date         date;
Line: 304

    select ppf.person_id from per_all_people_f ppf
    where (ppf.person_id = p_person_id or p_person_id is null)
    and   ppf.business_group_id = p_business_group_id
    and   l_effective_date between ppf.effective_start_date
          and ppf.effective_end_date
    and    (p_organization_id is null
           or exists (select null
                      from   per_all_assignments_f paa
                      where  paa.person_id = ppf.person_id
                      and    l_effective_date
                             between paa.effective_start_date
                             and     paa.effective_end_date
                      and    paa.business_group_id = ppf.business_group_id
                      and    paa.primary_flag = 'Y'
                      and    paa.organization_id = p_organization_id))
    and   (p_location_id is null
          or exists (select null
                     from   per_all_assignments_f paa
                     where  paa.person_id = ppf.person_id
                     and    l_effective_date
                            between paa.effective_start_date
                            and     paa.effective_end_date
                     and    paa.business_group_id = ppf.business_group_id
                     and    paa.primary_flag = 'Y'
                     and    paa.location_id = p_location_id))
    and   (p_benfts_grp_id is null
          or exists (select null
                     from   per_all_people_f pap
                     where  pap.person_id = ppf.person_id
                     and    pap.business_group_id = ppf.business_group_id
                     and    l_effective_date
                            between pap.effective_start_date
                            and     pap.effective_end_date
                     and    pap.benefit_group_id = p_benfts_grp_id))
    and   (p_legal_entity_id is null
          or exists (select null
                     from   per_assignments_f paf,
                            hr_soft_coding_keyflex soft
                     where  paf.person_id = ppf.person_id
                     and    paf.assignment_type <> 'C'
                     and    l_effective_date
                            between paf.effective_start_date
                            and     paf.effective_end_date
                     and    paf.business_group_id = ppf.business_group_id
                     and    paf.primary_flag = 'Y'
                     and    soft.soft_coding_keyflex_id = paf.soft_coding_keyflex_id
                     and    soft.segment1 = to_char(p_legal_entity_id)))
    and   (p_payroll_id is null
           or exists (select null
                      from per_all_assignments_f paf,
                           pay_payrolls_f pay
                      where paf.person_id = ppf.person_id
                      and   pay.payroll_id  = paf.payroll_id
                      and   paf.payroll_id = p_payroll_id
                      and   paf.assignment_type <> 'C'
                      and   paf.primary_flag = 'Y'
                      and   l_effective_date
                            between paf.effective_start_date
                            and     paf.effective_end_date
                      and   l_effective_date
                            between pay.effective_start_date
                            and     pay.effective_end_date));
Line: 411

      ,p_person_selection_rl    => p_person_selection_rl
      ,p_no_programs_flag       => 'N'
      ,p_no_plans_flag          => 'N'
      ,p_derivable_factors_flag => 'N'
      ,p_validate_flag          => 'N'
      ,p_audit_log_flag         => p_audit_log_flag
      ,p_ler_id                 => p_life_event_id
      ,p_date_from              => l_from_ocrd_date --reuse
      ,p_lf_evt_ocrd_dt         => l_to_ocrd_date   -- reuse
      ,p_organization_id        => p_organization_id
      ,p_location_id            => p_location_id
      ,p_benfts_grp_id          => p_benfts_grp_id
      ,p_legal_entity_id        => p_legal_entity_id
      ,p_payroll_id             => p_payroll_id
      ,p_ptnl_ler_for_per_stat_cd => p_life_evt_typ_cd     --reuse
      ,p_elig_enrol_cd            => p_bckt_stat_cd        --reuse
      ,p_debug_messages_flag    => p_delete_life_evt       --reuse
      ,p_object_version_number  => l_object_version_number
      ,p_effective_date         => l_effective_date
      ,p_request_id             => fnd_global.conc_request_id
      ,p_program_application_id => fnd_global.prog_appl_id
      ,p_program_id             => fnd_global.conc_program_id
      ,p_program_update_date    => sysdate);
Line: 441

    delete from ben_batch_ranges
     where benefit_action_id = l_benefit_action_id;
Line: 455

      if p_person_selection_rl is not null then
        --
	 person_selection_rule
                 (p_person_id                 => l_rec.person_id
                 ,p_business_group_id         => p_business_group_id
                 ,p_person_selection_rule_id  => p_person_selection_rl
                 ,p_effective_date            => l_effective_date
		 ,p_return                    => l_person_ok
                 ,p_err_message               => l_err_message );
Line: 619

                        ,argument16  => p_delete_life_evt
                        );
Line: 642

      ,p_person_selection_rule_id => p_person_selection_rl
      );
Line: 646

                       'No person got selected with above selection criteria.');
Line: 676

    ,p_delete_life_evt    => p_delete_life_evt
    );
Line: 685

  if p_delete_ptnl_life_evt = 'Y' and p_delete_life_evt = 'Y'
  then
   --
        delete from ben_ptnl_ler_for_per
         where ptnl_ler_for_per_stat_cd = 'VOIDD'
           and   business_group_id = p_business_group_id
	   and   (p_life_event_id is null or ler_id = p_life_event_id)
	   and   (p_person_id is null or person_id = p_person_id);
Line: 696

      ben_batch_utils.write(p_text => ' No. of Voided Potentials Deleted   = ' || sql%rowcount );
Line: 697

  elsif p_delete_ptnl_life_evt = 'Y' and p_delete_life_evt = 'N'
  then
      If p_person_id is not null then
        delete from ben_ptnl_ler_for_per p
         where p.ptnl_ler_for_per_stat_cd = 'VOIDD'
            and   p.business_group_id = p_business_group_id
          and   p.person_id = p_person_id
            and not exists ( select 1
                       from ben_per_in_ler pil
		       where pil.PTNL_LER_FOR_PER_ID = p.PTNL_LER_FOR_PER_ID);
Line: 708

         delete from ben_ptnl_ler_for_per p
          where p.ptnl_ler_for_per_stat_cd = 'VOIDD'
            and   p.business_group_id = p_business_group_id
            and not exists ( select 1
                       from ben_per_in_ler pil
		       where pil.PTNL_LER_FOR_PER_ID = p.PTNL_LER_FOR_PER_ID);
Line: 716

      ben_batch_utils.write(p_text => ' No. of Voided Potentials Deleted   = ' || sql%rowcount );
Line: 727

  delete from ben_elig_cvrd_dpnt_f t
  where business_group_id = p_business_group_id
  and not exists ( select 1 from ben_per_in_ler p
                   where p.per_in_ler_id = t.per_in_ler_id ) ;
Line: 732

  delete from ben_pl_bnf_f t
  where business_group_id = p_business_group_id
  and   not exists ( select 1 from ben_per_in_ler p
                     where p.per_in_ler_id = t.per_in_ler_id );
Line: 741

    ,p_person_selected   => l_person_actn_cnt
    ,p_business_group_id => p_business_group_id);
Line: 765

                                 ,p_person_selected   => l_person_actn_cnt
                                 ,p_business_group_id => p_business_group_id);
Line: 798

  ,p_delete_life_evt          in     varchar2
  )
  is
  --
  -- Local variable declaration
  --
  l_effective_date         date;
Line: 824

  select ran.range_id
        ,ran.starting_person_action_id
        ,ran.ending_person_action_id
    from ben_batch_ranges ran
   where ran.range_status_cd = 'U'
     and ran.benefit_action_id  = p_benefit_action_id
     and rownum < 2
     for update of ran.range_status_cd;
Line: 835

  select ben.person_id
        ,ben.person_action_id
        ,ben.object_version_number
    from ben_person_actions ben
   where ben.benefit_action_id = p_benefit_action_id
     and ben.action_status_cd <> 'P'
     and ben.person_action_id between l_start_person_action_id
                                  and l_end_person_action_id
   order by ben.person_action_id;
Line: 847

  select *
    from ben_benefit_actions ben
   where ben.benefit_action_id = p_benefit_action_id;
Line: 946

    ,p_person_selection_rule_id => l_parm.person_selection_rl
    ,p_location_id              => l_parm.location_id
    ,p_ler_id                   => l_parm.ler_id
    ,p_organization_id          => l_parm.organization_id
    ,p_benfts_grp_id            => l_parm.benfts_grp_id
    ,p_legal_entity_id          => l_parm.legal_entity_id
    ,p_payroll_id               => l_parm.payroll_id
    ,p_from_ocrd_date           => l_parm.date_from
    ,p_to_ocrd_date             => l_parm.lf_evt_ocrd_dt
    ,p_life_evt_typ_cd          => l_parm.ptnl_ler_for_per_stat_cd
    ,p_bckt_stat_cd             => l_parm.elig_enrol_cd
    ,p_delete_life_evt          => l_parm.debug_messages_flag
    ,p_audit_log                => p_audit_log_flag);
Line: 973

    update ben_batch_ranges ran
       set ran.range_status_cd = 'P'
     where ran.range_id = l_range_id;
Line: 977

    hr_utility.set_location('Updated range ' || to_char(l_range_id) ||
                            ' status code to P', 10);
Line: 984

    g_cache_per_proc.delete;
Line: 1006

      update ben_person_actions
         set action_status_cd = 'T'
       where person_action_id = l_person_action_id;
Line: 1036

            ,p_delete_life_evt  => p_delete_life_evt
            );
Line: 1065

      update ben_person_actions
      set action_status_cd = 'E'
      where person_action_id = g_cache_per_proc(l_cnt).person_action_id;
Line: 1101

  benutils.write(p_text => 'Table Name                 No. Of Rows Deleted');
Line: 1174

  select --to_char(process_date, 'YYYY/MM/DD HH24:MI:SS') process_date
         fnd_date.date_to_canonical(process_date) process_date
        ,business_group_id
        ,person_id
        ,person_selection_rl
        --,life_event_id
        --,from_ocrd_date
        ,lf_evt_ocrd_dt  -- mapped to t_ocrd_date
        ,organization_id
        ,location_id
        ,benfts_grp_id
        ,legal_entity_id
        ,payroll_id
        ,CM_TRGR_TYP_CD   -- mapped to lf_evt_typ_cd
        ,PTNL_LER_FOR_PER_STAT_CD -- mapped to bck_stat_cd
        ,audit_log_flag
    From ben_benefit_actions ben
   Where ben.benefit_action_id = p_benefit_action_id;
Line: 1231

    ,p_Person_selection_rl      => l_parameters.Person_selection_rl
    --,p_life_event_id            => l_parameters.life_event_id
    --,p_from_ocrd_date           => l_parameters.
    ,p_to_ocrd_date             => l_parameters.lf_evt_ocrd_dt
    ,p_organization_id          => l_parameters.organization_id
    ,p_location_id              => l_parameters.location_id
    ,p_benfts_grp_id            => l_parameters.benfts_grp_id
    ,p_legal_entity_id          => l_parameters.legal_entity_id
    ,p_payroll_id               => l_parameters.payroll_id
    ,p_life_evt_typ_cd          => l_parameters.CM_TRGR_TYP_CD
    ,p_bckt_stat_cd             => l_parameters.PTNL_LER_FOR_PER_STAT_CD
    ,p_audit_log_flag           => l_parameters.audit_log_flag
    );
Line: 1259

            ,p_delete_life_evt          in     varchar2
            )
             is

--
  l_from_ocrd_date  date;
Line: 1267

    select per_in_ler_id
    from  ben_per_in_ler pil
    where pil.person_id = p_person_id
    and   pil.business_group_id = p_business_group_id
    and   pil.per_in_ler_stat_cd in ('BCKDT','VOIDD')
    and   (p_life_event_id is null or pil.ler_id = p_life_event_id)
    and   pil.lf_evt_ocrd_dt between l_from_ocrd_date and p_to_ocrd_date
    and   (p_life_evt_typ_cd is null or
           exists (select null
                   from ben_ler_f ler
                   where ler.ler_id = pil.ler_id
                   and ler.typ_cd = p_life_evt_typ_cd
                   and pil.lf_evt_ocrd_dt between ler.effective_start_date and
                       ler.effective_end_date));
Line: 1283

    select per_in_ler_id
    from  ben_per_in_ler pil
    where pil.person_id = p_person_id
    and   pil.business_group_id = p_business_group_id
    and   pil.per_in_ler_stat_cd in ('VOIDD')
    and   (p_life_event_id is null or pil.ler_id = p_life_event_id)
    and   pil.lf_evt_ocrd_dt between l_from_ocrd_date and p_to_ocrd_date
    and   (p_life_evt_typ_cd is null or
           exists (select null
                   from ben_ler_f ler
                   where ler.ler_id = pil.ler_id
                   and ler.typ_cd = p_life_evt_typ_cd
                   and pil.lf_evt_ocrd_dt between ler.effective_start_date and
                       ler.effective_end_date));
Line: 1299

    select elig_per_elctbl_chc_id
    from   ben_elig_per_elctbl_chc epe
    where  epe.per_in_ler_id = p_per_in_ler_id;
Line: 1304

    select prtt_enrt_rslt_id
    from   ben_prtt_enrt_rslt_f pen
    where  pen.per_in_ler_id = p_per_in_ler_id
    and    pen.prtt_enrt_rslt_stat_cd in ('BCKDT','VOIDD');
Line: 1335

   hr_utility.set_location('delete elig per',2);
Line: 1340

      delete from ben_elig_per_f pep
        where pep.per_in_ler_id = t_per_in_ler(i);
Line: 1345

      delete from ben_elig_per_opt_f epo
        where epo.per_in_ler_id = t_per_in_ler(i);
Line: 1351

   hr_utility.set_location('delete elig per',3);
Line: 1356

		delete from ben_pil_elctbl_chc_popl pel
		where pel.per_in_ler_id = t_per_in_ler2(i);
Line: 1364

       t_elctbl_chc.delete;
Line: 1365

       t_rslt.delete; -- Added while fixing 3670708
Line: 1378

         hr_utility.set_location('delete enrt rt',1);
Line: 1380

            delete from ben_enrt_rt
            where elig_per_elctbl_chc_id = t_elctbl_chc(i);
Line: 1385

            delete from ben_enrt_rt
            where enrt_bnft_id in
            (select enrt_bnft_id
               from ben_enrt_bnft
              where elig_per_elctbl_chc_id = t_elctbl_chc(i));
Line: 1393

            delete from ben_enrt_prem
            where elig_per_elctbl_chc_id = t_elctbl_chc(i);
Line: 1398

            delete from ben_enrt_prem
            where enrt_bnft_id in
            (select enrt_bnft_id
               from ben_enrt_bnft
              where elig_per_elctbl_chc_id = t_elctbl_chc(i));
Line: 1406

            delete from ben_elctbl_chc_ctfn
            where elig_per_elctbl_chc_id  =  t_elctbl_chc(i);
Line: 1411

            delete from ben_elctbl_chc_ctfn
            where  enrt_bnft_id in
                  (select enrt_bnft_id
                     from ben_enrt_bnft
                    where elig_per_elctbl_chc_id = t_elctbl_chc(i));
Line: 1419

            delete from ben_enrt_bnft
            where elig_per_elctbl_chc_id  =  t_elctbl_chc(i);
Line: 1427

           delete from ben_pil_elctbl_chc_popl pel
           where pel.pil_elctbl_chc_popl_id =
              (select pil_elctbl_chc_popl_id
               from ben_elig_per_elctbl_chc
               where elig_per_elctbl_chc_id =  t_elctbl_chc(i));
Line: 1437

            delete from ben_elig_per_elctbl_chc
            where elig_per_elctbl_chc_id  =  t_elctbl_chc(i);
Line: 1442

            delete from ben_elig_dpnt
            where elig_per_elctbl_chc_id  =  t_elctbl_chc(i);
Line: 1452

           delete from ben_prtt_rt_val
           where prtt_enrt_rslt_id = t_rslt(i);
Line: 1458

           delete from ben_prtt_enrt_actn_f
           where prtt_enrt_rslt_id = t_rslt(i);
Line: 1464

           delete from ben_prtt_prem_f
           where prtt_enrt_rslt_id = t_rslt(i);
Line: 1470

           delete from ben_prtt_enrt_ctfn_prvdd_f
           where prtt_enrt_rslt_id = t_rslt(i);
Line: 1476

           delete from ben_elig_cvrd_dpnt_f
           where prtt_enrt_rslt_id = t_rslt(i);
Line: 1482

           delete from ben_prtt_enrt_rslt_f
           where prtt_enrt_rslt_id = t_rslt(i);
Line: 1488

           delete from ben_pl_bnf_f
           where prtt_enrt_rslt_id = t_rslt(i);
Line: 1494

           delete from ben_prmry_care_prvdr_f
           where prtt_enrt_rslt_id = t_rslt(i);
Line: 1502

      delete from ben_le_clsn_n_rstr
        where per_in_ler_id = t_per_in_ler2(i);
Line: 1506

     if p_delete_life_evt = 'Y' then
       forall i in 1..t_per_in_ler2.last
         delete from ben_ptnl_ler_for_per
          where ptnl_ler_for_per_id = (select ptnl_ler_for_per_id
                                       from ben_per_in_ler pil
                                       where per_in_ler_id = t_per_in_ler2(i))
          and ptnl_ler_for_per_stat_cd = 'VOIDD';
Line: 1515

         delete from ben_per_in_ler
           where per_in_ler_id = t_per_in_ler2(i);