DBA Data[Home] [Help]

APPS.BEN_PERSON_DELETE SQL Statements

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

Line: 5

/* Bug 13067080; Procedure added to delete person related CWB table records */
Line: 6

PROCEDURE delete_missing_cwb_tables (
       p_person_id   NUMBER
    ) IS

       CURSOR c1 IS
 	 SELECT        cwb_matrix_id
 	 FROM	       ben_cwb_matrix
 	 WHERE	    person_id = p_person_id
 	 FOR UPDATE OF cwb_matrix_id;
Line: 20

 	 SELECT        cwb_matrix_dtl_id
 	 FROM	       ben_cwb_matrix_dtl
 	 WHERE	       cwb_matrix_id = p_cwb_matrix_id
 	 FOR UPDATE OF cwb_matrix_dtl_id;
Line: 27

 	    delete from BEN_CWB_STOCK_OPTN_DTLS where person_id = p_person_id;
Line: 29

 	    delete from BEN_CWB_RPT_DETAIL where  person_id = p_person_id;
Line: 39

 	    DELETE FROM ben_cwb_matrix_dtl
 	    WHERE  CURRENT OF c2;
Line: 43

 	 DELETE FROM ben_cwb_matrix
 	 WHERE	CURRENT OF c1;
Line: 50

END delete_missing_cwb_tables;
Line: 59

         SELECT 1
         FROM   ben_batch_actn_item_info
         WHERE  person_id = p_person_id;
Line: 65

         SELECT 1
         FROM   ben_batch_bnft_cert_info
         WHERE  person_id = p_person_id;
Line: 71

         SELECT 1
         FROM   ben_batch_commu_info
         WHERE  person_id = p_person_id;
Line: 77

         SELECT 1
         FROM   ben_batch_dpnt_info
         WHERE  person_id = p_person_id;
Line: 83

         SELECT 1
         FROM   ben_batch_elctbl_chc_info
         WHERE  person_id = p_person_id;
Line: 89

         SELECT 1
         FROM   ben_batch_elig_info
         WHERE  person_id = p_person_id;
Line: 95

         SELECT 1
         FROM   ben_batch_ler_info
         WHERE  person_id = p_person_id;
Line: 101

         SELECT 1
         FROM   ben_batch_rate_info
         WHERE  person_id = p_person_id;
Line: 107

         SELECT 1
         FROM   ben_benefit_actions
         WHERE  person_id = p_person_id;
Line: 113

         SELECT 1
         FROM   ben_crt_ordr
         WHERE  person_id = p_person_id;
Line: 119

         SELECT 1
         FROM   ben_crt_ordr_cvrd_per
         WHERE  person_id = p_person_id;
Line: 125

         SELECT 1
         FROM   ben_elig_per_f
         WHERE  person_id = p_person_id;
Line: 131

         SELECT 1
         FROM   ben_ext_chg_evt_log
         WHERE  person_id = p_person_id;
Line: 137

         SELECT 1
         FROM   ben_ext_rslt_dtl
         WHERE  person_id = p_person_id;
Line: 143

         SELECT 1
         FROM   ben_ext_rslt_err
         WHERE  person_id = p_person_id;
Line: 149

         SELECT 1
         FROM   ben_le_clsn_n_rstr lct,
                ben_per_in_ler pil
         WHERE  pil.person_id = p_person_id
           AND  pil.per_in_ler_id = lct.per_in_ler_id;   /* Bug 4882374 : Perf */
Line: 157

         SELECT 1
         FROM   ben_person_actions
         WHERE  person_id = p_person_id;
Line: 163

         SELECT 1
         FROM   ben_per_bnfts_bal_f
         WHERE  person_id = p_person_id;
Line: 169

         SELECT 1
         FROM   ben_per_cm_f
         WHERE  person_id = p_person_id;
Line: 175

         SELECT 1
         FROM   ben_per_dlvry_mthd_f
         WHERE  person_id = p_person_id;
Line: 181

         SELECT 1
         FROM   ben_per_in_ler
         WHERE  person_id = p_person_id;
Line: 187

         SELECT 1
         FROM   ben_per_in_lgl_enty_f
         WHERE  person_id = p_person_id;
Line: 193

         SELECT 1
         FROM   ben_per_in_org_unit_f
         WHERE  person_id = p_person_id;
Line: 199

         SELECT 1
         FROM   ben_per_pin_f
         WHERE  person_id = p_person_id;
Line: 205

         SELECT 1
         FROM   ben_popl_org_f
         WHERE  person_id = p_person_id;
Line: 211

         SELECT 1
         FROM   ben_prtt_enrt_rslt_f
         WHERE  person_id = p_person_id;
Line: 217

         SELECT 1
         FROM   ben_ptnl_ler_for_per
         WHERE  person_id = p_person_id;
Line: 223

         SELECT 1
         FROM   ben_reporting rep,
                ben_person_actions pat
         WHERE  pat.person_id = p_person_id
           AND  rep.benefit_action_id = pat.benefit_action_id;   /* Bug 4882374 : Perf */
Line: 231

         SELECT 1
         FROM   ben_elig_cvrd_dpnt_f
         WHERE  dpnt_person_id = p_person_id;
Line: 237

         SELECT 1
         FROM   ben_prtt_reimbmt_rqst_f
         WHERE  submitter_person_id = p_person_id;
Line: 243

         SELECT 1
         FROM   ben_prtt_reimbmt_rqst_f
         WHERE  recipient_person_id = p_person_id;
Line: 249

         SELECT 1
         FROM   ben_prtt_reimbmt_rqst_f
         WHERE  provider_person_id = p_person_id;
Line: 255

         SELECT 1
         FROM   ben_prtt_reimbmt_rqst_f
         WHERE  provider_ssn_person_id = p_person_id;
Line: 261

         SELECT 1
         FROM   ben_cbr_quald_bnf
         WHERE  cvrd_emp_person_id = p_person_id;
Line: 268

         SELECT 1
         FROM   ben_pl_bnf_f
         WHERE  bnf_person_id = p_person_id;
Line: 1140

   PROCEDURE delete_dependent_information (
      p_person_id   IN   NUMBER,
      p_per_in_ler_id IN NUMBER default NULL
   ) IS

 l_proc              varchar2(100):= g_package||'delete_dependent_information';
Line: 1148

         SELECT elig_cvrd_dpnt_id, dpnt_person_id
         FROM            ben_elig_cvrd_dpnt_f
         WHERE           dpnt_person_id = p_person_id
	 and             per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id)
         FOR UPDATE OF elig_cvrd_dpnt_id,dpnt_person_id;
Line: 1158

         SELECT        crt_ordr_cvrd_per_id
         FROM          ben_crt_ordr_cvrd_per
         WHERE         crt_ordr_id IN (SELECT crt_ordr_id
                                       FROM   ben_crt_ordr
                                       WHERE  person_id = p_dpnt_person_id)
         FOR UPDATE OF crt_ordr_id;
Line: 1169

         SELECT        cvrd_dpnt_ctfn_prvdd_id
         FROM          ben_cvrd_dpnt_ctfn_prvdd_f
         WHERE         elig_cvrd_dpnt_id = p_elig_cvrd_dpnt_id
         FOR UPDATE OF elig_cvrd_dpnt_id;
Line: 1176

         SELECT        elig_cvrd_dpnt_id
         FROM          ben_prtt_enrt_actn_f
         WHERE         elig_cvrd_dpnt_id = p_elig_cvrd_dpnt_id
         FOR UPDATE OF elig_cvrd_dpnt_id;
Line: 1185

         SELECT        elig_cvrd_dpnt_id
         FROM          ben_prmry_care_prvdr_f
         WHERE         elig_cvrd_dpnt_id = p_elig_cvrd_dpnt_id
         FOR UPDATE OF elig_cvrd_dpnt_id;
Line: 1194

         SELECT        elig_cvrd_dpnt_id
         FROM          ben_cvrd_dpnt_ctfn_prvdd_f
         WHERE         elig_cvrd_dpnt_id = p_elig_cvrd_dpnt_id
         FOR UPDATE OF elig_cvrd_dpnt_id;
Line: 1203

         SELECT        elig_cvrd_dpnt_id
         FROM          ben_elig_cvrd_dpnt_f
         WHERE         elig_cvrd_dpnt_id = p_elig_cvrd_dpnt_id
         FOR UPDATE OF elig_cvrd_dpnt_id;
Line: 1212

         SELECT        elig_cvrd_dpnt_id
         FROM          ben_elig_dpnt
         WHERE         elig_cvrd_dpnt_id = p_elig_cvrd_dpnt_id
         FOR UPDATE OF elig_cvrd_dpnt_id;
Line: 1221

         SELECT        ext_crit_val_id
         FROM          ben_ext_crit_val
         WHERE         ext_crit_val_id IN
                             (SELECT DISTINCT ext_crit_val_id
                              FROM            ben_ext_crit_val val,
                                              ben_ext_crit_typ typ
                              WHERE           typ.crit_typ_cd = 'PID'
AND                                           val.ext_crit_typ_id =
                                                          typ.ext_crit_typ_id
AND                                           val.val_1 =
                                                 TO_CHAR (
                                                    p_elig_cvrd_dpnt_id
                                                 ))
         FOR UPDATE OF ext_crit_val_id;
Line: 1238

         SELECT        elig_cvrd_dpnt_id
         FROM          ben_elig_dpnt
         WHERE         dpnt_person_id = p_elig_cvrd_dpnt_id
         FOR UPDATE OF elig_cvrd_dpnt_id;
Line: 1252

		    DELETE FROM ben_crt_ordr_cvrd_per
		    WHERE  CURRENT OF c_crt_ordr_cvrd;
Line: 1260

            DELETE      ben_cvrd_dpnt_ctfn_prvdd_f
            WHERE  CURRENT OF c_cvrd_dpnt;
Line: 1271

            DELETE      ben_prtt_enrt_actn_f
            WHERE  CURRENT OF c1;
Line: 1283

            DELETE      ben_prmry_care_prvdr_f
            WHERE  CURRENT OF c2;
Line: 1295

            DELETE      ben_cvrd_dpnt_ctfn_prvdd_f
            WHERE  CURRENT OF c3;
Line: 1307

            DELETE      ben_elig_cvrd_dpnt_f
            WHERE  CURRENT OF c4;
Line: 1319

            DELETE      ben_elig_dpnt
            WHERE  CURRENT OF c5;
Line: 1331

            DELETE FROM ben_ext_crit_val
            WHERE  CURRENT OF c6;
Line: 1343

            DELETE      ben_elig_dpnt
            WHERE  CURRENT OF c7;
Line: 1347

         DELETE      ben_elig_cvrd_dpnt_f
         WHERE  CURRENT OF c_ecd;
Line: 1351

   END delete_dependent_information;
Line: 1354

   PROCEDURE delete_communications (
      p_person_id   IN   NUMBER,
      p_per_in_ler_id   IN   NUMBER default NULL
   ) IS
 l_proc              varchar2(100):= g_package||'delete_communications';
Line: 1363

         SELECT DISTINCT per_cm_id
         FROM            ben_per_cm_f
         WHERE           person_id = p_person_id
	 and             per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id);
Line: 1372

         SELECT        per_cm_prvdd_id
         FROM          ben_per_cm_prvdd_f
         WHERE         per_cm_id = p_per_cm_id
         FOR UPDATE OF per_cm_prvdd_id;
Line: 1381

         SELECT        per_cm_trgr_id
         FROM          ben_per_cm_trgr_f
         WHERE         per_cm_id = p_per_cm_id
         FOR UPDATE OF per_cm_trgr_id;
Line: 1390

         SELECT        per_cm_usg_id
         FROM          ben_per_cm_usg_f
         WHERE         per_cm_id = p_per_cm_id
         FOR UPDATE OF per_cm_usg_id;
Line: 1405

            DELETE FROM ben_per_cm_prvdd_f
            WHERE  CURRENT OF c2;
Line: 1416

            DELETE FROM ben_per_cm_trgr_f
            WHERE  CURRENT OF c3;
Line: 1427

            DELETE FROM ben_per_cm_usg_f
            WHERE  CURRENT OF c4;
Line: 1433

   END delete_communications;
Line: 1436

   PROCEDURE delete_life_events (
      p_person_id   IN   NUMBER,
      p_per_in_ler_id IN NUMBER default NULL
   ) IS
 l_proc              varchar2(100):= g_package||'delete_life_events';
Line: 1444

         SELECT DISTINCT per_in_ler_id
         FROM            ben_per_in_ler
         WHERE           person_id = p_person_id
	 and per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id);
Line: 1453

         SELECT DISTINCT prtt_prem_id
         FROM            ben_prtt_prem_f
         WHERE           per_in_ler_id = p_per_in_ler_id;
Line: 1459

         SELECT        prtt_prem_by_mo_id
         FROM          ben_prtt_prem_by_mo_f
         WHERE         prtt_prem_id = p_prtt_prem_id
         FOR UPDATE OF prtt_prem_by_mo_id;
Line: 1468

         SELECT DISTINCT prtt_enrt_rslt_id
         FROM            ben_prtt_enrt_rslt_f
         WHERE           per_in_ler_id = p_per_in_ler_id;
Line: 1476

         SELECT        prmry_care_prvdr_id
         FROM          ben_prmry_care_prvdr_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prmry_care_prvdr_id;
Line: 1485

         SELECT        bnft_prvdd_ldgr_id
         FROM          ben_bnft_prvdd_ldgr_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF bnft_prvdd_ldgr_id;
Line: 1494

         SELECT        elig_cvrd_dpnt_id
         FROM          ben_elig_cvrd_dpnt_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF elig_cvrd_dpnt_id;
Line: 1503

         SELECT        prtt_enrt_ctfn_prvdd_id
         FROM          ben_prtt_enrt_ctfn_prvdd_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prtt_enrt_ctfn_prvdd_id;
Line: 1512

         SELECT        prtt_prem_id
         FROM          ben_prtt_prem_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prtt_prem_id;
Line: 1521

         SELECT        prtt_rt_val_id
         FROM          ben_prtt_rt_val
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prtt_rt_val_id;
Line: 1530

         SELECT        prtt_enrt_actn_id
         FROM          ben_prtt_enrt_actn_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prtt_enrt_actn_id;
Line: 1539

         SELECT DISTINCT prtt_enrt_actn_id
         FROM            ben_prtt_enrt_actn_f
         WHERE           per_in_ler_id = p_per_in_ler_id;
Line: 1545

         SELECT        pl_bnf_ctfn_prvdd_id
         FROM          ben_pl_bnf_ctfn_prvdd_f
         WHERE         prtt_enrt_actn_id = p_prtt_enrt_actn_id
         FOR UPDATE OF pl_bnf_ctfn_prvdd_id;
Line: 1554

         SELECT        cvrd_dpnt_ctfn_prvdd_id
         FROM          ben_cvrd_dpnt_ctfn_prvdd_f
         WHERE         prtt_enrt_actn_id = p_prtt_enrt_actn_id
         FOR UPDATE OF cvrd_dpnt_ctfn_prvdd_id;
Line: 1563

         SELECT DISTINCT enrt_bnft_id
         FROM            ben_elig_per_elctbl_chc b1, ben_enrt_bnft b2
         WHERE           b1.per_in_ler_id = p_per_in_ler_id
AND                      b2.elig_per_elctbl_chc_id =
                                                    b1.elig_per_elctbl_chc_id;
Line: 1573

         SELECT        enrt_rt_id
         FROM          ben_enrt_rt
         WHERE         enrt_bnft_id = p_enrt_bnft_id
         FOR UPDATE OF enrt_rt_id;
Line: 1584

         SELECT DISTINCT elig_per_elctbl_chc_id
         FROM            ben_elig_per_elctbl_chc
         WHERE           per_in_ler_id = p_per_in_ler_id;
Line: 1590

         SELECT        enrt_bnft_id
         FROM          ben_enrt_bnft
         WHERE         elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
         FOR UPDATE OF enrt_bnft_id;
Line: 1599

         SELECT        enrt_prem_id
         FROM          ben_enrt_prem
         WHERE         elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
         FOR UPDATE OF enrt_prem_id;
Line: 1608

         SELECT        enrt_rt_id
         FROM          ben_enrt_rt
         WHERE         elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
         FOR UPDATE OF enrt_rt_id;
Line: 1617

         SELECT        elctbl_chc_ctfn_id
         FROM          ben_elctbl_chc_ctfn
         WHERE         elig_per_elctbl_chc_id = p_elig_per_elctbl_chc_id
         FOR UPDATE OF elctbl_chc_ctfn_id;
Line: 1628

         SELECT DISTINCT elig_cvrd_dpnt_id
         FROM            ben_prtt_enrt_rslt_f b1, ben_elig_cvrd_dpnt b2
         WHERE           b1.per_in_ler_id = p_per_in_ler_id
AND                      b2.prtt_enrt_rslt_id = b1.prtt_enrt_rslt_id;
Line: 1637

         SELECT        prmry_care_prvdr_id
         FROM          ben_prmry_care_prvdr_f
         WHERE         elig_cvrd_dpnt_id = p_elig_cvrd_dpnt_id
         FOR UPDATE OF prmry_care_prvdr_id;
Line: 1646

         SELECT        cbr_per_in_ler_id
         FROM          ben_cbr_per_in_ler
         WHERE         per_in_ler_id = p_per_in_ler_id
         FOR UPDATE OF cbr_per_in_ler_id;
Line: 1655

         SELECT        elig_dpnt_id
         FROM          ben_elig_dpnt
         WHERE         per_in_ler_id = p_per_in_ler_id
         FOR UPDATE OF elig_dpnt_id;
Line: 1664

         SELECT        elig_per_elctbl_chc_id
         FROM          ben_elig_per_elctbl_chc
         WHERE         per_in_ler_id = p_per_in_ler_id
         FOR UPDATE OF elig_per_elctbl_chc_id;
Line: 1673

         SELECT        elig_per_opt_id
         FROM          ben_elig_per_opt_f
         WHERE         per_in_ler_id = p_per_in_ler_id
         FOR UPDATE OF elig_per_opt_id;
Line: 1682

         SELECT        bkup_tbl_id
         FROM          ben_le_clsn_n_rstr
         WHERE         per_in_ler_id = p_per_in_ler_id
         FOR UPDATE OF bkup_tbl_id;
Line: 1691

         SELECT        pil_elctbl_chc_popl_id
         FROM          ben_pil_elctbl_chc_popl
         WHERE         per_in_ler_id = p_per_in_ler_id
         FOR UPDATE OF pil_elctbl_chc_popl_id;
Line: 1700

         SELECT        pl_bnf_id
         FROM          ben_pl_bnf_f
         WHERE         per_in_ler_id = p_per_in_ler_id
         FOR UPDATE OF pl_bnf_id;
Line: 1709

         SELECT        prtt_enrt_rslt_id
         FROM          ben_prtt_enrt_rslt_f
         WHERE         per_in_ler_id = p_per_in_ler_id
         FOR UPDATE OF prtt_enrt_rslt_id;
Line: 1729

               DELETE FROM ben_prtt_prem_by_mo_f
               WHERE  CURRENT OF c3;
Line: 1744

               DELETE FROM ben_prmry_care_prvdr_f
               WHERE  CURRENT OF c5;
Line: 1755

               DELETE FROM ben_bnft_prvdd_ldgr_f
               WHERE  CURRENT OF c6;
Line: 1766

               DELETE FROM ben_elig_cvrd_dpnt_f
               WHERE  CURRENT OF c7;
Line: 1777

               DELETE FROM ben_prtt_enrt_ctfn_prvdd_f
               WHERE  CURRENT OF c8;
Line: 1788

               DELETE FROM ben_prtt_prem_f
               WHERE  CURRENT OF c9;
Line: 1799

               DELETE FROM ben_prtt_rt_val
               WHERE  CURRENT OF c10;
Line: 1810

               DELETE FROM ben_prtt_enrt_actn_f
               WHERE  CURRENT OF c11;
Line: 1825

               DELETE FROM ben_pl_bnf_ctfn_prvdd_f
               WHERE  CURRENT OF c13;
Line: 1836

               DELETE FROM ben_cvrd_dpnt_ctfn_prvdd_f
               WHERE  CURRENT OF c14;
Line: 1852

               DELETE FROM ben_enrt_rt
               WHERE  CURRENT OF c16;
Line: 1868

               DELETE FROM ben_enrt_bnft
               WHERE  CURRENT OF c18;
Line: 1881

               DELETE FROM ben_enrt_prem
               WHERE  CURRENT OF c19;
Line: 1894

               DELETE FROM ben_enrt_rt
               WHERE  CURRENT OF c20;
Line: 1907

               DELETE FROM ben_elctbl_chc_ctfn
               WHERE  CURRENT OF c21;
Line: 1923

               DELETE FROM ben_prmry_care_prvdr_f
               WHERE  CURRENT OF c23;
Line: 1935

            DELETE FROM ben_cbr_per_in_ler
            WHERE  CURRENT OF c24;
Line: 1946

            DELETE FROM ben_elig_dpnt
            WHERE  CURRENT OF c25;
Line: 1958

            DELETE FROM ben_elig_per_elctbl_chc
            WHERE  CURRENT OF c26;
Line: 1969

            DELETE FROM ben_elig_per_opt_f
            WHERE  CURRENT OF c27;
Line: 1980

            DELETE FROM ben_le_clsn_n_rstr
            WHERE  CURRENT OF c28;
Line: 1991

            DELETE FROM ben_pil_elctbl_chc_popl
            WHERE  CURRENT OF c29;
Line: 2002

            DELETE FROM ben_pl_bnf_f
            WHERE  CURRENT OF c30;
Line: 2013

            DELETE FROM ben_prtt_enrt_rslt_f
            WHERE  CURRENT OF c31;
Line: 2019

   END delete_life_events;
Line: 2022

   PROCEDURE delete_participant_information (
      p_person_id   IN   NUMBER,
      p_per_in_ler_id IN NUMBER default NULL
   ) IS
 l_proc              varchar2(100):= g_package||'delete_participant_information';
Line: 2033

         SELECT DISTINCT prtt_enrt_rslt_id
         FROM            ben_prtt_enrt_rslt_f
         WHERE           person_id = p_person_id
	 and per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id);
Line: 2042

         SELECT        prmry_care_prvdr_id
         FROM          ben_prmry_care_prvdr_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prmry_care_prvdr_id;
Line: 2052

         SELECT        bnft_prvdd_ldgr_id
         FROM          ben_bnft_prvdd_ldgr_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF bnft_prvdd_ldgr_id;
Line: 2061

         SELECT        elig_cvrd_dpnt_id
         FROM          ben_elig_cvrd_dpnt_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF elig_cvrd_dpnt_id;
Line: 2070

         SELECT        prtt_enrt_ctfn_prvdd_id
         FROM          ben_prtt_enrt_ctfn_prvdd_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prtt_enrt_ctfn_prvdd_id;
Line: 2080

         SELECT        prtt_prem_id
         FROM          ben_prtt_prem_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prtt_prem_id;
Line: 2089

         SELECT        prtt_rt_val_id
         FROM          ben_prtt_rt_val
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prtt_rt_val_id;
Line: 2096

         SELECT        prtt_enrt_actn_id
         FROM          ben_prtt_enrt_actn_f
         WHERE         prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
         FOR UPDATE OF prtt_enrt_actn_id;
Line: 2113

            DELETE FROM ben_prmry_care_prvdr_f
            WHERE  CURRENT OF c2;
Line: 2124

            DELETE FROM ben_bnft_prvdd_ldgr_f
            WHERE  CURRENT OF c3;
Line: 2135

            DELETE FROM ben_elig_cvrd_dpnt_f
            WHERE  CURRENT OF c4;
Line: 2146

            DELETE FROM ben_prtt_enrt_ctfn_prvdd_f
            WHERE  CURRENT OF c5;
Line: 2157

            DELETE FROM ben_prtt_prem_f
            WHERE  CURRENT OF c6;
Line: 2168

            DELETE FROM ben_prtt_rt_val
            WHERE  CURRENT OF c7;
Line: 2179

            DELETE FROM ben_prtt_enrt_actn_f
            WHERE  CURRENT OF c8;
Line: 2185

   END delete_participant_information;
Line: 2188

   PROCEDURE delete_benefit_action_children (
      p_person_id   IN   NUMBER,
      p_per_in_ler_id IN NUMBER DEFAULT NULL
   ) IS

 l_proc              varchar2(100):= g_package||'delete_benefit_action_children';
Line: 2197

         SELECT DISTINCT benefit_action_id
         FROM            ben_benefit_actions bba
	                 --,ben_ler_f ler
         WHERE           person_id = p_person_id
	                 and ( (p_per_in_ler_id is not NULL and MODE_CD = 'U') or (p_per_in_ler_id is NULL) );
Line: 2211

         SELECT        reporting_id
         FROM          ben_reporting
         WHERE         benefit_action_id = p_benefit_action_id
         FOR UPDATE OF reporting_id;
Line: 2218

         SELECT        person_action_id
         FROM          ben_person_actions
         WHERE         benefit_action_id = p_benefit_action_id
         FOR UPDATE OF person_action_id;
Line: 2225

         SELECT        range_id
         FROM          ben_batch_ranges
         WHERE         benefit_action_id = p_benefit_action_id
         FOR UPDATE OF range_id;
Line: 2242

            DELETE FROM ben_reporting
            WHERE  CURRENT OF c2;
Line: 2253

            DELETE FROM ben_person_actions
            WHERE  CURRENT OF c3;
Line: 2264

            DELETE FROM ben_batch_ranges
            WHERE  CURRENT OF c4;
Line: 2270

   END delete_benefit_action_children;
Line: 2273

   PROCEDURE delete_reimbmt_rqst (
      p_person_id   NUMBER
   ) IS

--** C|c1
--** CN|c1|Fetch the prtt_reimbmt_rqst_id from ben_prtt_reimbmt_rqst_f associated with a person_id.
      CURSOR c1 IS
         SELECT        prtt_reimbmt_rqst_id
         FROM          ben_prtt_reimbmt_rqst_f
         WHERE         submitter_person_id = p_person_id
OR                     recipient_person_id = p_person_id
OR                     provider_person_id = p_person_id
OR                     provider_ssn_person_id = p_person_id
OR                     contact_relationship_id IN
                             (SELECT contact_relationship_id
                              FROM   per_contact_relationships
                              WHERE  person_id = p_person_id)
         FOR UPDATE OF prtt_reimbmt_rqst_id;
Line: 2296

         SELECT        prtt_reimbmt_recon_id
         FROM          ben_prtt_reimbmt_recon
         WHERE         prtt_reimbmt_rqst_id = p_prtt_reimbmt_rqst_id
         FOR UPDATE OF prtt_reimbmt_recon_id;
Line: 2310

            DELETE FROM ben_prtt_reimbmt_recon
            WHERE  CURRENT OF c2;
Line: 2314

         DELETE FROM ben_prtt_reimbmt_rqst_f
         WHERE  CURRENT OF c1;
Line: 2317

   END delete_reimbmt_rqst;
Line: 2320

   /* Bug 13540525 : Added new parameter 'p_per_in_ler_id' to pass Unrestricted per_in_ler_id. If p_per_in_ler_id is not NULL then delete Unrestricted LE
   enrollment data, else delete all Benefits data*/

   PROCEDURE delete_ben_rows (
      p_person_id   NUMBER,
      p_per_in_ler_id   IN   NUMBER default NULL
   ) IS
      --** C|c01
      CURSOR c01 (
         p_benefit_action_id   IN   NUMBER
      ) IS
         SELECT        benefit_action_id
         FROM          ben_reporting
         WHERE         benefit_action_id = p_benefit_action_id
         FOR UPDATE OF benefit_action_id;
Line: 2338

         SELECT DISTINCT elig_per_id
         FROM            ben_elig_per_f
         WHERE           person_id = p_person_id
	 and  per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id);
Line: 2345

         SELECT DISTINCT element_entry_id
         FROM            per_all_assignments_f paf, pay_element_entries_f pee
         WHERE           paf.person_id = p_person_id
AND                      pee.assignment_id = paf.assignment_id;
Line: 2352

         SELECT        batch_actn_item_id
         FROM          ben_batch_actn_item_info a,ben_benefit_actions b
         WHERE         a.person_id = p_person_id
	 and a.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
         and           b.person_id = p_person_id--Bug 14505730
         and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF batch_actn_item_id;
Line: 2364

         SELECT        batch_benft_cert_id
         FROM          ben_batch_bnft_cert_info a,ben_benefit_actions b
         WHERE         a.person_id = p_person_id
	 and a.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
         and           b.person_id = p_person_id--Bug 14505730
         and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF batch_benft_cert_id;
Line: 2376

         SELECT        batch_commu_id
         FROM          ben_batch_commu_info a,ben_benefit_actions b
         WHERE         a.person_id = p_person_id
	 and a.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
         and           b.person_id = p_person_id--Bug 14505730
         and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF batch_commu_id;
Line: 2388

         SELECT        batch_dpnt_id
         FROM          ben_batch_dpnt_info a,ben_benefit_actions b
         WHERE         a.person_id = p_person_id
	 and a.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
         and           b.person_id = p_person_id--Bug 14505730
         and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF batch_dpnt_id;
Line: 2400

         SELECT        batch_elctbl_id
         FROM          ben_batch_elctbl_chc_info a,ben_benefit_actions b
         WHERE         a.person_id = p_person_id
	 and a.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
         and           b.person_id = p_person_id--Bug 14505730
         and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF batch_elctbl_id;
Line: 2412

         SELECT        batch_elig_id
         FROM          ben_batch_elig_info a,ben_benefit_actions b
         WHERE         a.person_id = p_person_id
	 and a.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
         and           b.person_id = p_person_id--Bug 14505730
         and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF batch_elig_id;
Line: 2424

         SELECT        batch_ler_id
         FROM          ben_batch_ler_info a,ben_benefit_actions b
         WHERE         a.person_id = p_person_id
	 and a.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
         and           b.person_id = p_person_id--Bug 14505730
         and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF batch_ler_id;
Line: 2436

         SELECT        batch_rt_id
         FROM          ben_batch_rate_info a,ben_benefit_actions b
         WHERE         a.person_id = p_person_id
	 and a.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
         and           b.person_id = p_person_id--Bug 14505730
         and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF batch_rt_id;
Line: 2448

         SELECT        reporting_id
         FROM          ben_reporting rep,
                       ben_person_actions pat,
		       ben_benefit_actions b
         WHERE         pat.person_id = p_person_id
	   and         pat.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
	   and         ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
           AND         rep.benefit_action_id = pat.benefit_action_id  /* Bug 4882374 : Perf */
           AND         rep.person_id = p_person_id --Bug 14505730
           AND           b.person_id = p_person_id--Bug 14505730
         FOR UPDATE OF rep.reporting_id;
Line: 2464

         SELECT        person_action_id
         FROM          ben_person_actions a,ben_benefit_actions b
         WHERE         a.person_id = p_person_id
	 and a.BENEFIT_ACTION_ID = b.BENEFIT_ACTION_ID
         and           b.person_id = p_person_id--Bug 14505730
         and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF person_action_id;
Line: 2476

         SELECT        benefit_action_id
         FROM          ben_benefit_actions b
         WHERE         person_id = p_person_id
	 and ( (p_per_in_ler_id is not NULL and b.MODE_CD = 'U') or (p_per_in_ler_id is NULL) )
         FOR UPDATE OF benefit_action_id;
Line: 2486

         SELECT        cbr_quald_bnf_id
         FROM          ben_cbr_quald_bnf
         WHERE         cvrd_emp_person_id = p_person_id
         FOR UPDATE OF cbr_quald_bnf_id;
Line: 2495

         SELECT        crt_ordr_cvrd_per_id
         FROM          ben_crt_ordr_cvrd_per
         WHERE         crt_ordr_id IN (SELECT crt_ordr_id
                                       FROM   ben_crt_ordr
                                       WHERE  person_id = p_person_id)
         FOR UPDATE OF crt_ordr_cvrd_per_id;
Line: 2506

         SELECT        crt_ordr_id
         FROM          ben_crt_ordr
         WHERE         person_id = p_person_id
         FOR UPDATE OF crt_ordr_id;
Line: 2515

         SELECT        elig_per_id
         FROM          ben_elig_per_f
         WHERE         person_id = p_person_id
	 and  per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id)
         FOR UPDATE OF elig_per_id;
Line: 2525

         SELECT        ext_chg_evt_log_id
         FROM          ben_ext_chg_evt_log
         WHERE         person_id = p_person_id
         FOR UPDATE OF ext_chg_evt_log_id;
Line: 2534

         SELECT        ext_rslt_dtl_id
         FROM          ben_ext_rslt_dtl
         WHERE         person_id = p_person_id
         FOR UPDATE OF ext_rslt_dtl_id;
Line: 2543

         SELECT        ext_rslt_err_id
         FROM          ben_ext_rslt_err
         WHERE         person_id = p_person_id
         FOR UPDATE OF ext_rslt_err_id;
Line: 2552

         SELECT        per_bnfts_bal_id
         FROM          ben_per_bnfts_bal_f
         WHERE         person_id = p_person_id
         FOR UPDATE OF per_bnfts_bal_id;
Line: 2561

         SELECT        per_cm_id
         FROM          ben_per_cm_f
         WHERE         person_id = p_person_id
	 and  per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id)
         FOR UPDATE OF per_cm_id;
Line: 2571

         SELECT        per_dlvry_mthd_id
         FROM          ben_per_dlvry_mthd_f
         WHERE         person_id = p_person_id
         FOR UPDATE OF per_dlvry_mthd_id;
Line: 2580

         SELECT        per_in_ler_id
         FROM          ben_per_in_ler
         WHERE         person_id = p_person_id
	 and  per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id)
         FOR UPDATE OF per_in_ler_id;
Line: 2590

         SELECT        per_in_lgl_enty_id
         FROM          ben_per_in_lgl_enty_f
         WHERE         person_id = p_person_id
         FOR UPDATE OF per_in_lgl_enty_id;
Line: 2599

         SELECT        per_in_org_unit_id
         FROM          ben_per_in_org_unit_f
         WHERE         person_id = p_person_id
         FOR UPDATE OF per_in_org_unit_id;
Line: 2608

         SELECT        per_pin_id
         FROM          ben_per_pin_f
         WHERE         person_id = p_person_id
         FOR UPDATE OF per_pin_id;
Line: 2617

         SELECT        ptnl_ler_for_per_id
         FROM          ben_ptnl_ler_for_per ptnl,ben_ler_f ler
         WHERE         person_id = p_person_id
	 and           ler.ler_id = ptnl.ler_id
	 and           ( (p_per_in_ler_id is not NULL and ler.typ_cd = 'SCHEDDU') or (p_per_in_ler_id is NULL) )
	 and           trunc(sysdate) between ler.effective_start_date and ler.effective_end_date
         FOR UPDATE OF ptnl_ler_for_per_id;
Line: 2629

         SELECT        popl_org_id
         FROM          ben_popl_org_f
         WHERE         person_id = p_person_id
         FOR UPDATE OF popl_org_id;
Line: 2638

         SELECT        ext_crit_val_id
         FROM          ben_ext_crit_val
         WHERE         ext_crit_val_id IN (SELECT DISTINCT ext_crit_val_id
                                           FROM            ben_ext_crit_val val,
                                                           ben_ext_crit_typ typ
                                           WHERE           typ.crit_typ_cd =
                                                                        'PID'
AND                                                        val.ext_crit_typ_id =
                                                              typ.ext_crit_typ_id
AND                                                        val.val_1 =
                                                              TO_CHAR (
                                                                 p_person_id
                                                              ))
         FOR UPDATE OF ext_crit_val_id;
Line: 2656

         SELECT        pl_bnf_id
         FROM          ben_pl_bnf_f
         WHERE         bnf_person_id = p_person_id
	 and           per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id)
         FOR UPDATE OF pl_bnf_id;
Line: 2668

         SELECT        PIL_ELCTBL_CHC_POPL_ID
         FROM          ben_pil_elctbl_chc_popl
         WHERE         per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id)
	 FOR UPDATE OF PIL_ELCTBL_CHC_POPL_ID;
Line: 2681

         SELECT        ELIG_PER_ELCTBL_CHC_ID
         FROM          BEN_ELIG_PER_ELCTBL_CHC
         WHERE         per_in_ler_id = nvl(p_per_in_ler_id,per_in_ler_id)
	 FOR UPDATE OF ELIG_PER_ELCTBL_CHC_ID;
Line: 2694

      delete_dependent_information (
         p_person_id,
	 p_per_in_ler_id
      );
Line: 2698

      delete_communications (
         p_person_id,
	 p_per_in_ler_id
      );
Line: 2702

      delete_life_events (
         p_person_id,
	 p_per_in_ler_id
      );
Line: 2706

      delete_participant_information (
         p_person_id,
	 p_per_in_ler_id
      );
Line: 2710

      /*Bug 14505730 Duplicate delete cursors
      delete_benefit_action_children (
         p_person_id,
	 p_per_in_ler_id
      );
Line: 2716

	   /* Bug 13067080; Procedure added to delete person related CWB table records */
Line: 2717

      delete_missing_cwb_tables(
           p_person_id
      );
Line: 2722

         DELETE FROM ben_elig_per_wv_pl_typ_f
         WHERE       elig_per_id = r7.elig_per_id;
Line: 2726

         DELETE FROM ben_prtt_vstg_f
         WHERE       element_entry_id = r9.element_entry_id;
Line: 2729

      delete_reimbmt_rqst (
         p_person_id
      );
Line: 2740

         DELETE FROM ben_batch_actn_item_info
         WHERE  CURRENT OF c20;
Line: 2752

         DELETE FROM ben_batch_bnft_cert_info
         WHERE  CURRENT OF c21;
Line: 2764

         DELETE FROM ben_batch_commu_info
         WHERE  CURRENT OF c22;
Line: 2776

         DELETE FROM ben_batch_dpnt_info
         WHERE  CURRENT OF c23;
Line: 2788

         DELETE FROM ben_batch_elctbl_chc_info
         WHERE  CURRENT OF c24;
Line: 2799

         DELETE FROM ben_batch_elig_info
         WHERE  CURRENT OF c25;
Line: 2810

         DELETE FROM ben_batch_ler_info
         WHERE  CURRENT OF c26;
Line: 2821

         DELETE FROM ben_batch_rate_info
         WHERE  CURRENT OF c27;
Line: 2832

         DELETE FROM ben_reporting
         WHERE  CURRENT OF c28;
Line: 2843

         DELETE FROM ben_person_actions
         WHERE  CURRENT OF c29;
Line: 2854

         DELETE FROM ben_benefit_actions
         WHERE  CURRENT OF c30;
Line: 2866

		 DELETE FROM ben_cbr_quald_bnf
		 WHERE  CURRENT OF c31;
Line: 2879

		 DELETE FROM ben_crt_ordr_cvrd_per
		 WHERE  CURRENT OF c32;
Line: 2890

		 DELETE FROM ben_crt_ordr
		 WHERE  CURRENT OF c33;
Line: 2902

         DELETE FROM ben_elig_per_f
         WHERE  CURRENT OF c34;
Line: 2914

		 DELETE FROM ben_ext_chg_evt_log
		 WHERE  CURRENT OF c35;
Line: 2925

		 DELETE FROM ben_ext_rslt_dtl
		 WHERE  CURRENT OF c36;
Line: 2936

		 DELETE FROM ben_ext_rslt_err
		 WHERE  CURRENT OF c37;
Line: 2947

		 DELETE FROM ben_per_bnfts_bal_f
		 WHERE  CURRENT OF c38;
Line: 2959

         DELETE FROM ben_per_cm_f
         WHERE  CURRENT OF c39;
Line: 2971

		 DELETE FROM ben_per_dlvry_mthd_f
		 WHERE  CURRENT OF c40;
Line: 2984

	 DELETE FROM BEN_CWB_AUDIT WHERE group_per_in_ler_id=l_id;
Line: 2986

	 DELETE FROM BEN_CWB_GROUP_HRCHY WHERE emp_per_in_ler_id=l_id;
Line: 2988

 	 DELETE FROM BEN_CWB_PERSON_GROUPS WHERE group_per_in_ler_id=l_id;
Line: 2990

	 DELETE FROM BEN_CWB_PERSON_TASKS WHERE group_per_in_ler_id=l_id;
Line: 2997

	  DELETE FROM BEN_CWB_HRCHY WHERE EMP_PIL_ELCTBL_CHC_POPL_ID = l_pil_elctbl_chc_popl_id;
Line: 3006

	  DELETE FROM BEN_CWB_MGR_HRCHY WHERE EMP_ELIG_PER_ELCTBL_CHC_ID = l_elig_per_elctbl_chc_id;
Line: 3007

	  DELETE FROM BEN_CWB_MGR_HRCHY_RBV WHERE EMP_ELIG_PER_ELCTBL_CHC_ID = l_elig_per_elctbl_chc_id;
Line: 3011

         DELETE FROM ben_per_in_ler
         WHERE  CURRENT OF c41;
Line: 3018

	      DELETE from BEN_CWB_PERSON_INFO where person_id = p_person_id;
Line: 3020

	      DELETE from BEN_CWB_PERSON_RATES where person_id = p_person_id;
Line: 3022

	      DELETE from BEN_CWB_SUMMARY where person_id = p_person_id;
Line: 3034

		 DELETE FROM ben_per_in_lgl_enty_f
		 WHERE  CURRENT OF c42;
Line: 3045

		 DELETE FROM ben_per_in_org_unit_f
		 WHERE  CURRENT OF c43;
Line: 3057

		 DELETE FROM ben_per_pin_f
		 WHERE  CURRENT OF c44;
Line: 3070

         DELETE FROM ben_ptnl_ler_for_per
         WHERE  CURRENT OF c45;
Line: 3083

		 DELETE FROM ben_popl_org_f
		 WHERE  CURRENT OF c46;
Line: 3094

		 DELETE FROM ben_ext_crit_val
		 WHERE  CURRENT OF c47;
Line: 3107

         DELETE FROM ben_pl_bnf_f
         WHERE  CURRENT OF c48;
Line: 3115

   END delete_ben_rows;
Line: 3117

   PROCEDURE check_ben_rows_before_delete(
                        p_person_id number ,
			p_effective_date date
                        ) is
      --
      l_proc  varchar2(200) := 'ben_person_delete.check_ben_rows_before_delete' ;
Line: 3124

 Allow Delete when UnRestricted LE is in STRTD state
 Do Not Allow Delete when Other types of LE is in STRTD state
 Do Not Allow Delete when Other types of LE is in PROCD state
 Allow Delete when Other types of LE is in BCKDT/VOIDD state
 */

      --cursor for the pils with STRTD status

      CURSOR c_pil( p_person_id number ,
                p_effective_date date
                ) is
        SELECT 'Y'
        FROM   ben_per_in_ler pil,
           ben_ler_f      ler
        WHERE  pil.person_id = p_person_id
        AND    pil.per_in_ler_stat_cd = 'STRTD'
        AND    pil.ler_id = ler.ler_id
        AND    pil.business_group_id = ler.business_group_id
        AND    p_effective_date between ler.effective_start_date and
                                    ler.effective_end_date
        AND    ler.typ_cd <> 'SCHEDDU' ;
Line: 3151

         SELECT 'Y'
         FROM   ben_prtt_enrt_rslt_f pen,
	        ben_ler_f      ler
         WHERE  pen.person_id=p_person_id and
                pen.prtt_enrt_rslt_stat_cd is null and
     --           pen.sspndd_flag='N' and            Needs to resolve suspended record also
                pen.effective_end_date = hr_api.g_eot and
                p_effective_date between pen.enrt_cvg_strt_dt and
                                         pen.enrt_cvg_thru_dt
	        and ler.ler_id=pen.ler_id
		AND pen.business_group_id = ler.business_group_id
                AND    p_effective_date between ler.effective_start_date and
                                    ler.effective_end_date
                AND    ler.typ_cd <> 'SCHEDDU';
Line: 3171

        SELECT 'Y'
        FROM   ben_prtt_rt_val prv,
               ben_prtt_enrt_rslt_f pen,
               ben_ler_f      ler
        WHERE
               pen.person_id=p_person_id and
               prv.prtt_enrt_rslt_id = pen.prtt_enrt_rslt_id and
               pen.prtt_enrt_rslt_stat_cd is null and
               p_effective_date between prv.rt_strt_dt and prv.rt_end_dt and
               prv.business_group_id = pen.business_group_id and
               prv.prtt_rt_val_stat_cd is null
	        and ler.ler_id=pen.ler_id
		AND pen.business_group_id = ler.business_group_id
                AND    p_effective_date between ler.effective_start_date and
                                    ler.effective_end_date
                AND    ler.typ_cd <> 'SCHEDDU';
Line: 3193

        SELECT 'Y'
        FROM   ben_elig_cvrd_dpnt_f ecd,
               ben_per_in_ler pil,
	       ben_ler_f      ler,
	       ben_prtt_enrt_rslt_f pen
        WHERE
               pil.person_id=p_person_id and
               pil.per_in_ler_id = ecd.per_in_ler_id and
               pil.business_group_id = ecd.business_group_id and
               p_effective_date between ecd.cvg_strt_dt and cvg_thru_dt and
               ecd.effective_end_date = hr_api.g_eot
	       and ecd.prtt_enrt_rslt_id = pen.prtt_enrt_rslt_id and
               pen.prtt_enrt_rslt_stat_cd is null
	        AND    pil.ler_id = ler.ler_id
		AND    pil.business_group_id = ler.business_group_id
		AND    p_effective_date between ler.effective_start_date and
					    ler.effective_end_date
		AND    ler.typ_cd <> 'SCHEDDU';
Line: 3217

        SELECT 'Y'
        FROM   ben_elig_cvrd_dpnt_f ecd,
	       ben_per_in_ler pil,
	       ben_ler_f      ler,
	       ben_prtt_enrt_rslt_f pen
        WHERE
               ecd.dpnt_person_id = p_person_id and
               p_effective_date between ecd.cvg_strt_dt and cvg_thru_dt and
               ecd.effective_end_date = hr_api.g_eot
	        and pil.per_in_ler_id = ecd.per_in_ler_id
		and pil.business_group_id = ecd.business_group_id
		and ecd.prtt_enrt_rslt_id = pen.prtt_enrt_rslt_id and
                pen.prtt_enrt_rslt_stat_cd is null
		AND    pil.ler_id = ler.ler_id
		AND    pil.business_group_id = ler.business_group_id
		AND    p_effective_date between ler.effective_start_date and
					    ler.effective_end_date
		AND    ler.typ_cd <> 'SCHEDDU';
Line: 3240

        SELECT 'Y'
        FROM   ben_pl_bnf_f pbn,
	       ben_per_in_ler pil,
               ben_ler_f      ler,
	       ben_prtt_enrt_rslt_f pen
        WHERE
               pbn.bnf_person_id = p_person_id and
               p_effective_date between pbn.dsgn_strt_dt and pbn.dsgn_thru_dt and
               pbn.effective_end_date = hr_api.g_eot
	        and pbn.prtt_enrt_rslt_id = pen.prtt_enrt_rslt_id and
                pen.prtt_enrt_rslt_stat_cd is null
	        and pil.per_in_ler_id=pbn.per_in_ler_id
		AND    pil.business_group_id = pbn.business_group_id
	        AND    pil.ler_id = ler.ler_id
		AND    pil.business_group_id = ler.business_group_id
		AND    p_effective_date between ler.effective_start_date and
					    ler.effective_end_date
		AND    ler.typ_cd <> 'SCHEDDU';
Line: 3356

    END check_ben_rows_before_delete ;
Line: 3359

/* Bug 13540525: Enhancement to delete Unrestricted LE and its related data.Added new procedure delete_unrestricted_le_enrts.
Check whether Payroll is processed for the employee. If not check if element entries are present for the enrollments.
If yes,delete the element entries. Now delete the Benefits data.*/

procedure delete_unrestricted_le_enrts(errbuf  out nocopy varchar2
,retcode                      out nocopy number
,p_business_group_id in number
,p_effective_date in varchar2
,p_person_id in number
,p_validate                in     varchar2 default 'N') is


l_effective_date date;
Line: 3375

select '1' from
ben_prtt_enrt_rslt_f pen,
ben_per_in_ler pil, ben_ler_f ler,
ben_prtt_rt_val prv
where pen.person_id = p_person_id
and pen.business_group_id = p_business_group_id
and pen.per_in_ler_id = pil.per_in_ler_id
and pen.prtt_enrt_rslt_stat_cd is null
and pil.per_in_ler_stat_cd not in ('VOIDD','BCKDT')
and pil.ler_id = ler.ler_id
and ler.typ_cd in  ('SCHEDDU')
and l_effective_date between ler.effective_start_date and ler.effective_end_date
and ler.business_group_id = p_business_group_id
and pen.enrt_cvg_strt_dt <= pen.enrt_cvg_thru_dt
and prv.per_in_ler_id = pil.per_in_ler_id
and prv.prtt_enrt_rslt_id = pen.prtt_enrt_rslt_id
and prv.PRTT_RT_VAL_STAT_CD is NULL
and prv.ELEMENT_ENTRY_VALUE_ID is not NULL;
Line: 3395

select 'y' from dual where exists
(SELECT NULL
         FROM pay_payroll_actions pac,
              pay_assignment_actions act,
              per_assignments_f asg
         WHERE asg.person_id = p_person_id
           AND act.assignment_id = asg.assignment_id
           --AND asg.assignment_type = p_type
           AND pac.payroll_action_id = act.payroll_action_id
           AND pac.action_status = 'C');
Line: 3409

select
   distinct ele.element_entry_id ele_entry_id,
ele.object_version_number ovn,
ele.effective_start_date esd
 from
ben_prtt_enrt_rslt_f pen,
ben_per_in_ler pil,
ben_ler_f ler,
ben_prtt_rt_val prv,
pay_element_entry_values_f elv,
pay_element_entries_f ele
where pen.person_id = p_person_id
and pen.business_group_id = p_business_group_id
and pen.per_in_ler_id = pil.per_in_ler_id
and pen.prtt_enrt_rslt_stat_cd is null
and pil.per_in_ler_stat_cd not in ('VOIDD','BCKDT')
and pil.ler_id = ler.ler_id
and ler.typ_cd in  ('SCHEDDU')
and l_effective_date between ler.effective_start_date and ler.effective_end_date
and ler.business_group_id = p_business_group_id
and pen.enrt_cvg_strt_dt <= pen.enrt_cvg_thru_dt
and prv.per_in_ler_id = pil.per_in_ler_id
and prv.prtt_enrt_rslt_id = pen.prtt_enrt_rslt_id
and prv.PRTT_RT_VAL_STAT_CD is NULL
and prv.ELEMENT_ENTRY_VALUE_ID = elv.ELEMENT_ENTRY_VALUE_ID
and elv.element_entry_id = ele.element_entry_id
order by ele.effective_start_date desc;
Line: 3438

select pil.per_in_ler_id
from ben_per_in_ler pil,
ben_ler_f ler
where pil.ler_id = ler.ler_id
and l_effective_date between ler.effective_start_date and ler.effective_end_date
and pil.person_id = p_person_id
and ler.business_group_id = p_business_group_id
and ler.typ_cd in  ('SCHEDDU');
Line: 3451

l_delete_warning  boolean;
Line: 3456

l_proc varchar2(100) := 'g_package'||'.delete_unrestricted_le_enrts';
Line: 3511

      ,p_program_update_date    => sysdate
    );
Line: 3558

			  py_element_entry_api.delete_element_entry
				(p_validate => l_validate
				,p_datetrack_delete_mode => hr_api.g_zap
				,p_effective_date        => l_ele_rec.esd
				,p_element_entry_id      => l_ele_rec.ele_entry_id
				,p_object_version_number => l_ele_rec.ovn
				,p_effective_start_date  => l_effective_start_date
				,p_effective_end_date    => l_effective_end_date
				,p_delete_warning        => l_delete_warning
				);
Line: 3571

		    ben_person_delete.delete_ben_rows(p_person_id,l_per_in_ler_id);
Line: 3577

	       ben_person_delete.delete_ben_rows(p_person_id,l_per_in_ler_id);
Line: 3611

update ben_person_actions
	  set action_status_cd = 'E'
	  where person_action_id = l_person_action_id;
Line: 3617

end delete_unrestricted_le_enrts;