DBA Data[Home] [Help]

APPS.OKC_RENEW_PVT SQL Statements

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

Line: 35

      SELECT id,object_version_number,uom_code,duration,tve_id_started,tve_id_ended,
	 tve_id_limited,tve_type
	 FROM okc_timevalues
      WHERE DNZ_CHR_ID = p_chr_id;
Line: 46

  SELECT nvl(rgp.cle_id,rgp.chr_id) comp_id  ,nvl(rul.rule_information1,g_def_cle_ren) rule_type
  FROM okc_rules_b rul,okc_rule_groups_b rgp
  WHERE    rgp.dnz_chr_id = p_chr_id
	 and   rgp.id=rul.rgp_id
--	 and   rgp.rgd_code='RENEW'
	 and   rul.rule_information_category='LRT' order by rgp.cle_id;
Line: 54

select id comp_id,nvl(line_renewal_type_code,g_def_cle_ren) rule_type
from okc_k_lines_b
where dnz_chr_id = p_chr_id;
Line: 59

select application_id from okc_k_headers_b where id = p_chr_id;
Line: 89

  SELECT k.id,k.contract_number,k.contract_number_modifier,k.start_date,k.END_date,k.object_version_number
    FROM okc_k_headers_b k,
         okc_statuses_b sts
   WHERE k.date_renewed is null
     and k.sts_code = sts.code
     and sts.ste_code in ('ACTIVE','EXPIRED','SIGNED')
     and k.date_terminated is null
     and k.template_yn = 'N'
     and k.id = p_chr_id ;
Line: 306

    SELECT sts_code,template_yn, application_id, scs_code,contract_number,
		 contract_number_modifier,end_date,date_terminated, start_date
    FROM   okc_k_headers_b
    WHERE  id = p_chr_id;
Line: 312

    SELECT ste_code
    FROM   okc_statuses_v
    WHERE  code = p_code;
Line: 391

                           p_msg_name      => 'OKC_NO_UPDATE',
                           p_token1        => 'CHR',
                           p_token1_value  => l_k);
Line: 472

    SELECT ID,
	   STS_CODE,
	   CONTRACT_NUMBER,
	   CONTRACT_NUMBER_MODIFIER,
	   TEMPLATE_YN,
	   DATE_TERMINATED,
	   DATE_RENEWED,
	   END_DATE
      FROM okc_k_headers_b
     WHERE id = p_renew_in_parameters_rec.p_contract_id;
Line: 484

   SELECT ste_code,meaning
     FROM okc_statuses_v
    WHERE code = p_sts_code;
Line: 489

    SELECT 'x'
      FROM okc_time_code_units_b
     WHERE uom_code = p_renew_in_parameters_rec.p_uom_code;
Line: 499

  SELECT qte.quote_number
  FROM okc_k_rel_objs_v rel,
	  aso_quote_headers_all_v qte
  WHERE jtot_object1_code = okc_oc_int_qtk_pvt.g_jtot_qte_hdr
  AND   chr_id            = p_chr_id
  AND   rty_code          = okc_oc_int_qtk_pvt.g_k2q_ren
  AND   rel.object1_id1   = qte.quote_header_id;
Line: 755

            SELECT ID
                    FROM okc_k_lines_b l, okc_statuses_b sts
                    WHERE sts.code = l.sts_code
                    and sts.ste_code in ('ACTIVE','EXPIRED','SIGNED')
                    and l.dnz_chr_id = p_contract_id
                   and l.date_renewed is null
                   and l.date_terminated is null;
Line: 787

PROCEDURE update_rules(
                 p_api_version                  IN  NUMBER,
                 p_init_msg_list                IN  VARCHAR2 ,
                 x_return_status                OUT NOCOPY VARCHAR2,
                 x_msg_count                    OUT NOCOPY NUMBER,
                 x_msg_data                     OUT NOCOPY VARCHAR2,
                 p_chr_id                       IN  number
                 )  is
BEGIN
 NULL;
Line: 797

END update_rules;
Line: 800

PROCEDURE update_rules(
                 p_api_version                  IN  NUMBER,
       	       p_init_msg_list                IN  VARCHAR2 ,
                 x_return_status                OUT NOCOPY VARCHAR2,
                 x_msg_count                    OUT NOCOPY NUMBER,
                 x_msg_data                     OUT NOCOPY VARCHAR2,
	            p_chr_id                       IN  number
			  )  is


CURSOR cur_rules(p_chr_id number) is
     SELECT nvl(rg.cle_id,rg.chr_id) parent_ID,ru.id id,ru.object_version_number,
		   ru.comments,ru.rule_information_category from
	okc_rules_v ru,okc_rule_groups_b rg
     WHERE  rgp_id=rg.id and rg.DNZ_CHR_ID = p_chr_id for update of ru.id nowait;
Line: 817

     SELECT start_date ,end_date FROM okc_time_ia_startend_val_v
     WHERE id = p_tve_id for update of id nowait;
Line: 829

l_api_name constant varchar2(30) := 'update_rules';
Line: 849

    SELECT id, orig_start_date, orig_end_date, start_date, end_date
    FROM   okc_cle_dates_tmp
    WHERE  id = b_id;
Line: 934

                	--san comment update the ia
                     -- okc_debug.log('2300: Before update_ia_startend');
Line: 936

				 OKC_TIME_PUB.UPDATE_IA_STARTEND(
					p_api_version=> p_api_version,
				     p_init_msg_list=> okc_api.g_false,
				     x_return_status=> l_return_status,
				     x_msg_count=>    x_msg_count,
				     x_msg_data=>     x_msg_data,
					p_isev_ext_rec=> l_isev_ext_rec_type,
				     x_isev_ext_rec=> i_isev_ext_rec_type) ;
Line: 958

	                 OKC_RULE_PUB.UPDATE_RULE(  p_api_version     	=> 1,
                                                 p_init_msg_list   	=> OKC_API.G_FALSE,
                                                 x_return_status   	=> l_return_status,
                                                 x_msg_count       	=> x_msg_count,
                                                 x_msg_data        	=> x_msg_data,
                                                 p_rulv_rec           => l_rulv_rec,
                                                 x_rulv_rec           => i_rulv_rec
                                             );
Line: 1007

       okc_debug.Set_Indentation('Update_Rules');
Line: 1008

       okc_debug.log('3000: Entered Update_Rules', 2);
Line: 1147

       okc_debug.log('4300:  Leaving Update_Rules', 2);
Line: 1155

       okc_debug.log('4400: Exiting Update_Rules:E_Resource_Busy Exception', 2);
Line: 1171

       okc_debug.log('4500: Exiting Update_Rules:OKC_API.G_EXCEPTION_ERROR Exception', 2);
Line: 1186

       okc_debug.log('4600: Exiting Update_Rules:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
Line: 1201

       okc_debug.log('4700: Exiting Update_Rules:OTHERS Exception', 2);
Line: 1214

END Update_Rules;
Line: 1217

PROCEDURE update_condition_headers (
                 p_api_version                  IN  NUMBER,
       	       p_init_msg_list                IN  VARCHAR2 ,
                 x_return_status                OUT NOCOPY VARCHAR2,
                 x_msg_count                    OUT NOCOPY NUMBER,
                 x_msg_data                     OUT NOCOPY VARCHAR2,
	            p_chr_id                       IN  NUMBER,
                 p_orig_start_date              IN  DATE,
                 p_orig_end_date                IN  DATE,
                 p_new_start_date               IN  DATE,
                 p_new_end_date                 IN  DATE ) is

 CURSOR cur_condition_headers is
 SELECT cnh.id,cnh.object_version_number,cnh.date_active,cnh.date_inactive
 FROM okc_condition_headers_b cnh
 WHERE dnz_chr_id = p_chr_id;
Line: 1242

 l_api_name constant varchar2(30) := 'update_headers';
Line: 1249

       okc_debug.log('4800: Entered update_condition_headers', 2);
Line: 1296

         okc_debug.log('5000: Before update_cond_hdrs');
Line: 1298

       okc_conditions_pub.update_cond_hdrs(
	              p_api_version   => 1,
	              p_init_msg_list => OKC_API.G_FALSE,
	              x_return_status => l_return_status,
	              x_msg_count     => x_msg_count,
	              x_msg_data      => x_msg_data,
	              p_cnhv_rec      => l_cnh_rec,
	              x_cnhv_rec      => i_cnh_rec  );
Line: 1307

         okc_debug.log('5100: After update_cond_hdrs');
Line: 1321

       okc_debug.log(' 5200:  Leaving update_condition_headers', 2);
Line: 1329

       okc_debug.log('5300: Exiting update_condition_headers:E_Resource_Busy Exception', 2);
Line: 1342

       okc_debug.log('5400: Exiting update_condition_headers:OKC_API.G_EXCEPTION_ERROR Exception', 2);
Line: 1357

       okc_debug.log('5500: Exiting update_condition_headers:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
Line: 1372

       okc_debug.log('5600: Exiting update_condition_headers:OTHERS Exception', 2);
Line: 1385

END update_condition_headers;
Line: 1387

PROCEDURE update_old_contract(
                 p_api_version                  IN NUMBER,
       	       p_init_msg_list                IN VARCHAR2 ,
                 x_return_status                OUT NOCOPY VARCHAR2,
                 x_msg_count                    OUT NOCOPY NUMBER,
                 x_msg_data                     OUT NOCOPY VARCHAR2,
	            p_new_header                   IN  number,
	            p_chr_id                       IN  number) is

 CURSOR cur_header(p_chr_id number) is
 SELECT id,object_version_number
 FROM okc_k_headers_b
 WHERE id = p_chr_id;
Line: 1402

 SELECT a.id,b.id cle_id_ren_to ,a.object_version_number
 FROM okc_k_lines_b a,okc_k_lines_b b
 WHERE a.dnz_chr_id = p_chr_id and a.id=b.cle_id_renewed and b.dnz_chr_id=p_new_header;
Line: 1422

 l_api_name constant VARCHAR2(30) := 'update_old_contract';
Line: 1427

       okc_debug.log('5700: Entered update_old_contract', 2);
Line: 1473

   	  okc_debug.log('6000: Before update_contract_header');
Line: 1475

	  okc_contract_pub.update_contract_header (
	      p_api_version => 1,
	      p_init_msg_list => OKC_API.G_FALSE,
	      x_return_status => l_return_status,
	      x_msg_count => x_msg_count,
	      x_msg_data => x_msg_data,
		 p_restricted_update => okc_api.g_true,
	      p_chrv_rec => l_chr_rec,
	      x_chrv_rec => i_chr_rec  );
Line: 1485

   	  okc_debug.log('6100: After update_contract_header');
Line: 1495

     SELECT l.id,l.object_version_number
	bulk collect into l_id_tbl,l_obj_tbl
     FROM okc_k_lines_b l, okc_operation_lines a
     where a.object_chr_id=p_chr_id and
		 a.subject_chr_id=p_new_header and
		a.active_yn='Y'
		and l.id=a.object_cle_id and
		a.subject_cle_id is not null and a.object_cle_id is not null;
Line: 1528

	      okc_contract_pub.update_contract_line (
	          p_api_version => 1,
	          p_init_msg_list => OKC_API.G_FALSE,
	          x_return_status => l_return_status,
	          x_msg_count => x_msg_count,
	          x_msg_data => x_msg_data,
		     p_restricted_update => okc_api.g_true,
	          p_clev_tbl => l_cle_tbl,
	          x_clev_tbl => x_cle_tbl  );
Line: 1550

       okc_debug.log('6200:  Leaving update_old_contract', 2);
Line: 1558

       okc_debug.log('6300: Exiting update_old_contract:OKC_API.G_EXCEPTION_ERROR Exception', 2);
Line: 1573

       okc_debug.log('6400: Exiting update_old_contract:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
Line: 1588

       okc_debug.log('6500: Exiting update_old_contract:OTHERS Exception', 2);
Line: 1599

END update_old_contract;
Line: 1609

PROCEDURE update_renewal_dates(p_api_version       IN  NUMBER,
                               p_init_msg_list     IN  VARCHAR2 ,
                               x_return_status     OUT NOCOPY VARCHAR2,
                               x_msg_count         OUT NOCOPY NUMBER,
                               x_msg_data          OUT NOCOPY VARCHAR2,
                               p_chr_id            IN  NUMBER,
                               p_parent_cle_id     IN  NUMBER ,
                               p_parent_new_st_dt  IN  DATE,
                               p_parent_new_end_dt IN  DATE,
                               p_parent_old_st_dt  IN  DATE,
                               p_cle_id            IN  NUMBER ,
                               p_rencon_yn         IN  VARCHAR2 )  is
BEGIN
  null;
Line: 1623

END update_renewal_dates;
Line: 1626

PROCEDURE update_renewal_dates(p_api_version       IN  NUMBER,
                               p_init_msg_list     IN  VARCHAR2 ,
                               x_return_status     OUT NOCOPY VARCHAR2,
                               x_msg_count         OUT NOCOPY NUMBER,
                               x_msg_data          OUT NOCOPY VARCHAR2,
                               p_chr_id            IN  NUMBER,
                               p_parent_cle_id     IN  NUMBER ,
                               p_parent_new_st_dt  IN  DATE,
                               p_parent_new_end_dt IN  DATE,
                               p_parent_old_st_dt  IN  DATE,
                               p_cle_id            IN  NUMBER ,
                               p_rencon_yn         IN  VARCHAR2 )  is

--/Rules Migration/-added application id
  CURSOR cur_headers is
  Select start_date,end_date,object_version_number,application_id
  from okc_k_headers_b
  where id = p_chr_id;
Line: 1646

  SELECT id,object_version_number,start_date,end_date,level,cle_id
  FROM okc_k_lines_b
  where dnz_chr_id=p_id
  start with (chr_id=p_id)
  connect by prior id=cle_id;
Line: 1655

       SELECT id,object_version_number,start_date,END_date,level,cle_id,price_negotiated
                  FROM okc_k_lines_b
                  where dnz_chr_id=l_chr_id
                  start with (chr_id=l_chr_id)
                  connect by prior id=cle_id;
Line: 1664

       SELECT id,object_version_number,start_date,END_date,level,cle_id,price_negotiated
                  FROM okc_k_lines_b
                  where dnz_chr_id=l_chr_id
                  start with (id=l_cle_id)
                  connect by prior id=cle_id;
Line: 1695

 l_api_name constant VARCHAR2(30) := 'update_renewal_dates';
Line: 1801

       okc_debug.log('6700: Entered Update_Renewal_Dates', 2);
Line: 1842

            okc_debug.log('6800: Before update_contract_header');
Line: 1849

         okc_contract_pub.update_contract_header (
	           p_api_version => 1,
	           p_init_msg_list => OKC_API.G_FALSE,
	           x_return_status => l_return_status,
	           x_msg_count => x_msg_count,
	           x_msg_data => x_msg_data,
	           p_chrv_rec => l_chr_rec,
	           x_chrv_rec => i_chr_rec  );
Line: 1860

            okc_debug.log('6900: After update_contract_header');
Line: 1871

          INSERT INTO okc_cle_dates_tmp(ID, ORIG_START_DATE, ORIG_END_DATE,
                                         START_DATE, END_DATE)
 VALUES (
             p_chr_id, header_rec.start_date, header_rec.end_date,
             p_parent_new_st_dt, p_parent_new_end_dt);
Line: 1965

                  SELECT id
                  bulk collect into g_parent_id_tbl
                  FROM okc_k_lines_b
                  where dnz_chr_id=p_chr_id
                  start with (id=p_parent_cle_id)
                  connect by prior cle_id=id;
Line: 2023

	        	l_parent_cle_tbl.delete;
Line: 2108

                  okc_debug.log('7100: Before update_contract_line');
Line: 2112

SELECT TO_DATE(TO_CHAR(l_cle_rec.start_date, 'dd/mm/yyYY') || TO_CHAR(start_date, 'hh24:mi:ss'), 'dd/mm/yyYYhh24:mi:ss'),
    decode(l_cle_rec.end_date, null, null, TO_DATE(TO_CHAR(l_cle_rec.end_date, 'dd/mm/yyYY') || TO_CHAR(end_date, 'hh24:mi:ss'), 'dd/mm/yyYYhh24:mi:ss'))
  INTO l_cle_rec.start_date, l_cle_rec.end_date
  FROM okc_k_lines_b
  WHERE id = (SELECT object_cle_id FROM okc_operation_lines WHERE subject_cle_id = l_cle_rec.id);
Line: 2118

               okc_contract_pub.update_contract_line (
	                p_api_version => 1,
	                p_init_msg_list => OKC_API.G_FALSE,
	                x_return_status => l_return_status,
	                x_msg_count => x_msg_count,
	                x_msg_data => x_msg_data,
	                p_clev_rec => l_cle_rec,
	                x_clev_rec => i_cle_rec  );
Line: 2127

                  okc_debug.log('7200: After update_contract_line');
Line: 2148

          INSERT INTO okc_cle_dates_tmp (ID, ORIG_START_DATE, ORIG_END_DATE,
                                         START_DATE, END_DATE)
VALUES (
             l_cle_rec.id, lines_rec.start_date, lines_rec.end_date,
             l_cle_rec.start_date, l_cle_rec.end_date);
Line: 2181

            OKC_CONTRACT_PUB.Delete_Contract_Line(
  		          p_api_version      => 1,
	               p_init_msg_list    => OKC_API.G_FALSE,
	               x_return_status    => l_return_status,
	               x_msg_count        => x_msg_count,
                    x_msg_data         => x_msg_data,
		          p_line_id          => l_cle_tbl(j).id);
Line: 2199

               UPDATE OKC_K_HEADERS_B
               set estimated_amount = estimated_amount - l_cle_tbl(j).price_negotiated
               WHERE  id = p_chr_id;
Line: 2215

          okc_debug.log('7300: Before update_rules');
Line: 2217

	  update_rules(p_api_version     	=> 1,
                 p_init_msg_list   	=> OKC_API.G_FALSE,
                 x_return_status   	=> l_return_status,
                 x_msg_count       	=> x_msg_count,
                 x_msg_data        	=> x_msg_data,
                 p_chr_id          	=> p_chr_id
			  );
Line: 2225

          okc_debug.log('7400: After update_rules');
Line: 2238

       okc_debug.log('7500:  Leaving Update_Renewal_Dates', 2);
Line: 2246

       okc_debug.log('7600: Exiting Update_Renewal_Dates:OKC_API.G_EXCEPTION_ERROR Exception', 2);
Line: 2267

       okc_debug.log('7700: Exiting Update_Renewal_Dates:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
Line: 2288

       okc_debug.log('7800: Exiting Update_Renewal_Dates:OTHERS Exception', 2);
Line: 2306

END Update_Renewal_Dates;
Line: 2437

  SELECT nvl(rul.rule_information1,OKC_API.G_MISS_CHAR) renew_type,
					 nvl(rul.rule_information2,OKC_API.G_MISS_CHAR) contact
  FROM okc_rules_b rul,okc_rule_groups_b rgp
  WHERE    rgp.dnz_chr_id = p_chr_id
	 and   rgp.id=rul.rgp_id
	 --and   rgp.rgd_code='RENEW'
	 and   rul.rule_information_category='REN' ;
Line: 2447

CURSOR cur_qa(p_chr_id number) is select nvl(qcl_id,OKC_API.G_MISS_NUM)
		    from OKC_K_HEADERS_b
		    where id=p_chr_id;
Line: 2454

 select nvl(qcl_id,OKC_API.G_MISS_NUM) qcl_id,
        nvl(renewal_type_code,OKC_API.G_MISS_CHAR) renewal_type_code,renewal_notify_to,
        application_id
 from OKC_K_HEADERS_b
 where id=p_chr_id;
Line: 2461

  is select pdf_id from okc_k_processes kp, okc_process_defs_b pd  where
	    kp.chr_id=p_chr_id and kp.pdf_id=pd.id and pd.usage='APPROVE';
Line: 2465

  is select fnd.user_name from okx_resources_v res, fnd_user fnd   where
               fnd.user_id=res.user_id and res.id1=p_user_id;
Line: 2469

 SELECT k.estimated_amount,k.scs_code,scs.cls_code,k.sts_code
   FROM OKC_K_HEADERS_B K,
  	   OKC_SUBCLASSES_B SCS
  WHERE k.id = p_renew_in_parameters_rec.p_contract_id
    AND k.scs_code = scs.code;
Line: 2476

  select start_date,end_date from okc_k_headers_b where
   id=p_chr_id;
Line: 2760

				-- call alex api to update status and resolve time values

			  -- update the date approved of the contract
                       IF (l_debug = 'Y') THEN
                          okc_debug.log('9300: Before k_approved');
Line: 3006

  SELECT nvl(rul.rule_information1, OKC_API.G_MISS_CHAR) renew_type,
         fnd_date.Canonical_To_Date(rul.rule_information3) ultimate_end_date
         --To_Date(rul.rule_information3, 'YYYY/MM/DD') ultimate_end_date
    FROM okc_rules_b rul,
         okc_rule_groups_b rgp
   WHERE rgp.dnz_chr_id = p_chr_id
     and rgp.id = rul.rgp_id
  -- and rgp.rgd_code = 'RENEW'
     and rul.rule_information_category = 'REN';
Line: 3018

/*cursor cur_org is select  authoring_org_id,inv_organization_id
from okc_k_headers_b
where id = p_renew_in_parameters_rec.p_contract_id;*/
Line: 3024

   	select authoring_org_id,inv_organization_id,application_id,
	nvl(renewal_type_code,OKC_API.G_MISS_CHAR) renewal_type_code,
     renewal_end_date
     from okc_k_headers_b
     where id = p_renew_in_parameters_rec.p_contract_id;
Line: 3300

        okc_debug.log('12100: Before update_renewal_dates');
Line: 3302

    update_renewal_dates(p_api_version     	=> 1,
                    p_init_msg_list   	=> OKC_API.G_FALSE,
                    x_return_status   	=> l_return_status,
                    x_msg_count       	=> x_msg_count,
                    x_msg_data        	=> x_msg_data,
                    p_chr_id          	=> x_contract_id,
				p_parent_new_st_dt  =>  l_renew_in_parameters_rec.p_start_date,
			     p_parent_new_end_dt =>  l_renew_in_parameters_rec.p_end_date,
				p_parent_old_st_dt  =>  l_renew_in_parameters_rec.p_orig_start_date);
Line: 3313

        okc_debug.log('12200: After update_renewal_dates');
Line: 3324

		 --update date_active and date_inactive in the condition headers for the renew copy

     IF (l_debug = 'Y') THEN
        okc_debug.log('123300: Before update_condition_headers');
Line: 3329

	update_condition_headers (p_api_version     	=> 1,
                               p_init_msg_list   	=> OKC_API.G_FALSE,
                               x_return_status   	=> l_return_status,
                               x_msg_count       	=> x_msg_count,
                               x_msg_data        	=> x_msg_data,
                               p_chr_id          	=> x_contract_id,
			                p_new_start_date   => l_renew_in_parameters_rec.p_start_date,
			                p_new_end_date     => l_renew_in_parameters_rec.p_end_date,
			                p_orig_start_date  => l_renew_in_parameters_rec.p_orig_start_date,
					      p_orig_end_date    => l_renew_in_parameters_rec.p_orig_end_date);
Line: 3341

        okc_debug.log('12400: After update_condition_headers');
Line: 3353

        okc_debug.log('12500: Before update_old_contract');
Line: 3355

	update_old_contract(p_api_version     	=> 1,
                                   p_init_msg_list   	=> OKC_API.G_FALSE,
                                   x_return_status   	=> l_return_status,
                                   x_msg_count       	=> x_msg_count,
                                   x_msg_data        	=> x_msg_data,
                                   p_new_header       	=> x_contract_id ,
                                   p_chr_id          	=> l_renew_in_parameters_rec.p_contract_id );
Line: 3364

        okc_debug.log('12600: After update_old_contract');
Line: 3374

	-- If this contract is being renewed from Quote, then update
	-- the contrcat with Quote information( like price, Ship-to etc.)
	-- The p_context is not null then this contract is being renewed
	-- by quote, so call the integration API that will update K with
	-- quote information.

	IF ( p_renew_in_parameters_rec.p_context IS NOT NULL
		AND
		p_renew_in_parameters_rec.p_context <>  OKC_API.G_MISS_CHAR ) THEN
        IF (l_debug = 'Y') THEN
           okc_debug.log('12700: Before create_k_from_q');
Line: 3471

Procedure Update_Parents_Date_Renewed( p_api_version        IN  NUMBER,
                                       p_init_msg_list      IN  VARCHAR2 ,
                                       x_return_status      OUT NOCOPY VARCHAR2,
                                       x_msg_count          OUT NOCOPY NUMBER,
                                       x_msg_data           OUT NOCOPY VARCHAR2,
                                       p_chr_id             IN NUMBER
                                     ) is
	l_top_count		NUMBER;
Line: 3488

     l_api_name constant VARCHAR2(30) := 'Update_Parents_Date_Renewed';
Line: 3492

                    SELECT distinct(cle_id_ascendant)
                    FROM OKC_UPD_REN_TEMP
                    WHERE level_sequence = l_level;
Line: 3499

       okc_debug.log('13300: Entered Update_Parents_Date_Renewed', 2);
Line: 3515

      select count(*) into l_invalid_chr_id
      from okc_k_headers_b
      where id = p_chr_id;
Line: 3525

        okc_debug.log('13400: Before Insert Into OKC_UPD_REN_TEMP');
Line: 3527

  	insert into OKC_UPD_REN_TEMP(DNZ_CHR_ID,
                                      CLE_ID,
                                     CLE_ID_ASCENDANT,
                                     LEVEL_SEQUENCE)
        select line.dnz_chr_id, ans.cle_id,
                                   ans.cle_id_ascendant, ans.level_sequence
  	from okc_k_lines_b line, okc_ancestrys ans
  	where line.id = ans.cle_id
    	  and line.dnz_chr_id = p_chr_id;
Line: 3538

	select count(*) into l_top_count
	from okc_k_lines_b line, okc_ancestrys ans
  	where line.id = ans.cle_id
    	   and line.dnz_chr_id = p_chr_id;
Line: 3545

                  select MAX(level_sequence) into l_level
                  from OKC_UPD_REN_TEMP
                  where dnz_chr_id = p_chr_id;
Line: 3557

                          select count(*) into l_line_count
                          from okc_k_lines_b
                          where cle_id = l_cle_id_ascendant;
Line: 3563

                             select count(*) into l_date_count
	                        from okc_k_lines_b
                             where cle_id = l_cle_id_ascendant
                                and date_renewed IS NULL;
Line: 3569

					    -- Update Date_Renewed field of parent line
                               update okc_k_lines_b
                               set date_renewed = ( select MAX(date_renewed )
                                                    from okc_k_lines_b
                                                    where cle_id = l_cle_id_ascendant )
                               where id = l_cle_id_ascendant;
Line: 3585

			select count(*) into l_no_lines_count
			from okc_k_lines_b
			where chr_id = p_chr_id;
Line: 3591

                  select count(*) into l_top_date_count
                  from okc_k_lines_b
                  where chr_id = p_chr_id
                    and date_renewed IS NULL;
Line: 3598

			   -- Update Date_Renewed field of contract header
                     update okc_k_headers_b
	  	           set date_renewed = ( select MAX(date_renewed)
			                           from okc_k_lines_b
			               	       where chr_id = p_chr_id )
                     where id = p_chr_id;
Line: 3608

   okc_debug.log('13500:  Leaving Update_Parents_Date_Renewed', 2);
Line: 3615

       okc_debug.log('13600: Exiting Update_Parents_Date_Renewed:OKC_API.G_EXCEPTION_ERROR Exception', 2);
Line: 3630

       okc_debug.log('13700: Exiting Update_Parents_Date_Renewed:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
Line: 3645

       okc_debug.log('13800: Exiting Update_Parents_Date_Renewed:Contract_Not_Found Exception', 2);
Line: 3655

       okc_debug.log('13900: Exiting Update_Parents_Date_Renewed:OTHERS Exception', 2);
Line: 3667

End Update_Parents_Date_Renewed;
Line: 3673

   SELECT a.subject_chr_id,
   		a.process_flag  -- bugfix 2952330, selecting Process_flag to check the value 'A'
    FROM okc_operation_lines a,okc_operation_instances  b, okc_class_operations c
    where a.object_chr_id=p_chr_id and
		c.id=b.cop_id and
		c.opn_code in ('RENEWAL', 'REN_CON')
		and b.id=a.oie_id and
--                a.active_yn='Y' and  /* Commented out to fix the bug 2108667 */
                a.subject_cle_id is null and
		a.object_cle_id is null
    order by a.active_yn desc,a.process_flag desc; /* Added this order by to get the 'Entered' contract
Line: 3691

   SELECT CONTRACT_NUMBER,CONTRACT_NUMBER_MODIFIER,ste_code
    FROM okc_k_headers_b k,okc_statuses_b  s
    where k.id=p_chr_id and k.sts_code=s.code;