DBA Data[Home] [Help]

APPS.CS_SR_PARTY_MERGE_PKG SQL Statements

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

Line: 35

   SELECT rowid,
          incident_id,
          customer_id,
          bill_to_contact_id,
          ship_to_contact_id,
          bill_to_party_id,
          ship_to_party_id,
          last_update_program_code
   FROM   cs_incidents_all_b
   WHERE  p_from_fk_id in (customer_id, bill_to_contact_id, ship_to_contact_id,
			   bill_to_party_id, ship_to_party_id )
   FOR    UPDATE NOWAIT;
Line: 54

   l_last_update_program_code	VARCHAR2_30_TBL;
Line: 77

   SELECT merge_reason_code
     INTO   l_merge_reason_code
     FROM   hz_merge_batch
    WHERE  batch_id  = p_batch_id;
Line: 110

	 -- obtain lock on records to be updated.
         arp_message.set_name('AR', 'AR_LOCKING_TABLE');
Line: 115

          LOOP            -- Loop for BULK selecting and  processing the BULK selection in a batch of 1000

	     FETCH c1 BULK COLLECT INTO l_rowid_tbl,
                                    l_incident_id,
                                    l_customer_id,
                                    l_bill_to_contact_id,
                                    l_ship_to_contact_id ,
                                    l_bill_to_party_id,
                                    l_ship_to_party_id ,
                                    l_last_update_program_code
             LIMIT 1000 ;
Line: 134

    	     -- if no records were found to be updated then stop and return to calling prg.
--	     IF l_rowid_tbl.count = 0 THEN
--	        RETURN;
Line: 140

	     UPDATE cs_incidents_all_b
  	        SET customer_id                 = decode(customer_id, p_from_fk_id,
					 		           p_to_fk_id, customer_id),
	            bill_to_contact_id          = decode(bill_to_contact_id, p_from_fk_id,
								       p_to_fk_id, bill_to_contact_id),
	            ship_to_contact_id          = decode(ship_to_contact_id, p_from_fk_id,
							           p_to_fk_id, ship_to_contact_id),
	            bill_to_party_id            = decode(bill_to_party_id,   p_from_fk_id,
							           p_to_fk_id, bill_to_party_id),
	            ship_to_party_id            = decode(ship_to_party_id,   p_from_fk_id,
							           p_to_fk_id, ship_to_party_id),
		    object_version_number       = object_version_number + 1,
                    incident_last_modified_date = sysdate ,
                    last_update_program_code    = 'PARTY_MERGE',
	            last_update_date            = SYSDATE,
	            last_updated_by             = G_USER_ID,
	            last_update_login           = G_LOGIN_ID
             WHERE  rowid                       = l_rowid_tbl(i);
Line: 161

             arp_message.set_name('AR', 'AR_ROWS_UPDATED');
Line: 195

                         l_audit_vals_rec.old_last_update_program_code  := l_last_update_program_code(i) ;
Line: 196

                         l_audit_vals_rec.last_update_program_code      := 'PARTY_MERGE' ;
Line: 197

                         l_audit_vals_rec.updated_entity_code           := 'SR_HEADER';
Line: 198

                         l_audit_vals_rec.updated_entity_id             := l_incident_id(i);
Line: 213

                            p_last_update_date    => SYSDATE,
                            p_creation_date       => SYSDATE,
                            p_comments            => NULL,
                            x_audit_id            => l_audit_id);
Line: 224

          END LOOP ;      -- End Loop for BULK selecting and  processing the BULK selection in a batch of 1000
Line: 301

   SELECT rowid,incident_id ,
          bill_to_site_use_id ,
          ship_to_site_use_id,
          last_update_program_code
     FROM cs_incidents_all_b
    WHERE p_from_fk_id in (bill_to_site_use_id, ship_to_site_use_id)
      FOR UPDATE NOWAIT;
Line: 316

   l_last_update_program_code   VARCHAR2_30_TBL;
Line: 332

   SELECT merge_reason_code
     INTO l_merge_reason_code
     FROM hz_merge_batch
    WHERE batch_id  = p_batch_id;
Line: 377

                   l_last_update_program_code
             LIMIT 1000;
Line: 393

	     UPDATE cs_incidents_all_b
	     SET    bill_to_site_use_id         = decode(bill_to_site_use_id, p_from_fk_id, p_to_fk_id,
					                            bill_to_site_use_id ),
	            ship_to_site_use_id         = decode(ship_to_site_use_id, p_from_fk_id, p_to_fk_id,
					                            ship_to_site_use_id ),
	    	    object_version_number       = object_version_number + 1,
                    incident_last_modified_date = sysdate,
                    last_update_program_code    = 'PARTY_MERGE',
	            last_update_date            = SYSDATE,
	            last_updated_by             = G_USER_ID,
	            last_update_login           = G_LOGIN_ID
             WHERE  rowid = l_rowid_tbl(i);
Line: 408

             arp_message.set_name('AR', 'AR_ROWS_UPDATED');
Line: 445

                             l_audit_vals_rec.old_last_update_program_code  := l_last_update_program_code(i) ;
Line: 446

                             l_audit_vals_rec.last_update_program_code      := 'PARTY_MERGE' ;
Line: 447

                             l_audit_vals_rec.updated_entity_code           := 'SR_HEADER';
Line: 448

                             l_audit_vals_rec.updated_entity_id             := l_incident_id(i);
Line: 463

                            p_last_update_date    => SYSDATE,
                            p_creation_date       => SYSDATE,
                            p_comments            => NULL,
                            x_audit_id            => l_audit_id);
Line: 474

          END LOOP ;  -- End Loop for BULK selecting and  processing the BULK selection in a batch of 1000
Line: 552

   SELECT rowid,
          incident_id ,
          site_id,
          customer_site_id,
          install_site_use_id,
          bill_to_site_id,
          ship_to_site_id,
          install_site_id,
          incident_location_id ,
          incident_location_type,
          last_update_program_code
   FROM   cs_incidents_all_b
   WHERE  p_from_fk_id IN (site_id, customer_site_id, install_site_use_id,
			   bill_to_site_id, ship_to_site_id, install_site_id)
      OR  (incident_location_type = 'HZ_PARTY_SITE' AND incident_location_id = p_from_fk_id)
   FOR    UPDATE NOWAIT;
Line: 588

   l_last_update_program_code	VARCHAR2_30_TBL ;
Line: 605

   SELECT merge_reason_code
   INTO   l_merge_reason_code
   FROM   hz_merge_batch
   WHERE  batch_id  = p_batch_id;
Line: 641

	    -- obtain lock on records to be updated.
         arp_message.set_name('AR', 'AR_LOCKING_TABLE');
Line: 658

                   l_last_update_program_code
             LIMIT 1000 ;
Line: 681

	     UPDATE cs_incidents_all_b
	     SET    site_id               = decode(site_id, p_from_fk_id, p_to_fk_id, site_id),
	            customer_site_id      = decode(customer_site_id, p_from_fk_id, p_to_fk_id,
								 customer_site_id),
	            bill_to_site_id       = decode(bill_to_site_id , p_from_fk_id, p_to_fk_id,
								 bill_to_site_id ),
	            ship_to_site_id       = decode(ship_to_site_id , p_from_fk_id, p_to_fk_id,
								 ship_to_site_id ),
	            install_site_id       = decode(install_site_id , p_from_fk_id, p_to_fk_id,
								 install_site_id ),
	            install_site_use_id   = decode(install_site_use_id, p_from_fk_id, p_to_fk_id,
								 install_site_use_id ),
                    incident_location_id  = Decode(NVL(incident_location_type,'XXX') ,
                                               'HZ_LOCATION',incident_location_id ,
                                               'HZ_PARTY_SITE',decode(incident_location_id,
                                                                      p_from_fk_id,p_to_fk_id,incident_location_id),
                                               'XXX',incident_location_id
                                              ),
                    incident_last_modified_date = sysdate ,
		    object_version_number = object_version_number + 1,
                    last_update_program_code = 'PARTY_MERGE',
	            last_update_date      = SYSDATE,
	            last_updated_by       = G_USER_ID,
	            last_update_login     = G_LOGIN_ID
             WHERE  rowid = l_rowid_tbl(i);
Line: 709

             arp_message.set_name('AR', 'AR_ROWS_UPDATED');
Line: 800

              l_audit_vals_rec. last_update_program_code    := 'PARTY_MERGE' ;
Line: 801

	      l_audit_vals_rec.old_last_update_program_code := l_last_update_program_code (i);
Line: 802

              l_audit_vals_rec.updated_entity_code          := 'SR_HEADER';
Line: 803

              l_audit_vals_rec.updated_entity_id            := l_incident_id(i);
Line: 818

                         p_last_update_date    => SYSDATE,
                         p_creation_date       => SYSDATE,
                         p_comments            => NULL,
                         x_audit_id            => l_audit_id);
Line: 887

   select rowid
   from   cs_incidents_audit_b
   where  p_from_fk_id in (bill_to_contact_id, ship_to_contact_id, old_bill_to_contact_id,
			   old_ship_to_contact_id)
   for    update nowait;
Line: 907

   select merge_reason_code
   into   l_merge_reason_code
   from   hz_merge_batch
   where  batch_id  = p_batch_id;
Line: 939

	    -- obtain lock on records to be updated.
         arp_message.set_name('AR', 'AR_LOCKING_TABLE');
Line: 952

	 update cs_incidents_audit_b
	 set bill_to_contact_id    = decode(bill_to_contact_id, p_from_fk_id, p_to_fk_id,
                                                                bill_to_contact_id ),
	     old_bill_to_contact_id= decode(old_bill_to_contact_id, p_from_fk_id, p_to_fk_id,
								old_bill_to_contact_id ),
	     ship_to_contact_id    = decode(ship_to_contact_id, p_from_fk_id, p_to_fk_id,
								ship_to_contact_id ),
	     old_ship_to_contact_id= decode(old_ship_to_contact_id, p_from_fk_id, p_to_fk_id,
								old_ship_to_contact_id ),
	     object_version_number = object_version_number + 1,
	     last_update_date      = SYSDATE,
	     last_updated_by       = G_USER_ID,
	     last_update_login     = G_LOGIN_ID
         where  rowid = l_rowid_tbl(i);
Line: 969

         arp_message.set_name('AR', 'AR_ROWS_UPDATED');
Line: 1055

   select rowid
   from   cs_incidents_audit_b
   where  p_from_fk_id in (site_id, old_site_id)
   for    update nowait;
Line: 1074

   select merge_reason_code
   into   l_merge_reason_code
   from   hz_merge_batch
   where  batch_id  = p_batch_id;
Line: 1106

	    -- obtain lock on records to be updated.
         arp_message.set_name('AR', 'AR_LOCKING_TABLE');
Line: 1119

	 update cs_incidents_audit_b
	 set site_id               = decode(site_id, p_from_fk_id, p_to_fk_id,
					             site_id),
	     old_site_id      = decode(old_site_id, p_from_fk_id, p_to_fk_id,
					            old_site_id),
	     object_version_number = object_version_number + 1,
	     last_update_date      = SYSDATE,
	     last_updated_by       = G_USER_ID,
	     last_update_login     = G_LOGIN_ID
         where  rowid = l_rowid_tbl(i);
Line: 1132

         arp_message.set_name('AR', 'AR_ROWS_UPDATED');
Line: 1182

   select 1
   from   cs_hz_sr_contact_points
   where  sr_contact_point_id = p_from_id
   and    party_id = p_from_fk_id
   and    contact_type <> 'EMPLOYEE'
   for    update nowait;
Line: 1213

   select merge_reason_code
   into   l_merge_reason_code
   from   hz_merge_batch
   where  batch_id  = p_batch_id;
Line: 1249

	    -- obtain lock on records to be updated.
         arp_message.set_name('AR', 'AR_LOCKING_TABLE');
Line: 1266

             select sr_contact_point_id INTO v_merged_to_id
             from cs_hz_sr_contact_points
             where party_id = p_to_fk_id
	     and   ( contact_point_id, incident_id ) = ( select contact_point_id, incident_id
		 					 from   cs_hz_sr_contact_points
							 where  sr_contact_point_id = p_from_id )
             and   sr_contact_point_id <> p_from_id
             and   contact_type <> 'EMPLOYEE'
	     and   rownum = 1;
Line: 1286

		    --Hence, just update the record with the new party id.

              ----dbms_output.put_line('hi 1' || v_merged_to_id);
Line: 1290

              UPDATE CS_HZ_SR_CONTACT_POINTS
              SET    party_id              = p_to_fk_id,
		     object_version_number = object_version_number + 1,
	             last_update_date      = SYSDATE,
	             last_updated_by       = G_USER_ID,
	             last_update_login     = G_LOGIN_ID
              WHERE  sr_contact_point_id = p_from_id
                AND  party_id    = p_from_fk_id
            RETURNING incident_id , sr_contact_point_id BULK COLLECT
                 INTO l_incident_id , l_sr_contact_point_id ;
Line: 1343

                              p_updated_entity_code   	=> 'SR_CONTACT_POINT',
                              p_updated_entity_id     	=> l_sr_contact_point_id(i) ,
                              p_entity_update_date    	=> sysdate ,
                              p_entity_activity_code  	=> 'U',
                              p_update_program_code     => 'PARTY_MERGE',
                              x_audit_id             	=> l_audit_id ,
                              x_return_status        	=> l_return_status ,
                              x_msg_count            	=> x_msg_count ,
                              x_msg_data            	=> x_msg_data  ) ;
Line: 1365

		  --HEnce, mark the the other found record as duplicate and update the current
		  --one which needs to updated with the new party id. WHile marking the record
		  --as DUPLICATE, check if it is the PRIMARY CONTACT. IF so, make the current one
		  --which is going to be updated with new party id,  as PRIMARY CONTACT

              --Found a record whcih results in duplicate, hence delete it
              DELETE FROM
              CS_HZ_SR_CONTACT_POINTS
              WHERE sr_contact_point_id = v_merged_to_id
              RETURNING primary_flag INTO l_primary_flag ;
Line: 1380

                UPDATE CS_HZ_SR_CONTACT_POINTS
                SET    party_id              = p_to_fk_id,
		       object_version_number = object_version_number + 1,
	               last_update_date        = SYSDATE,
	               last_updated_by         = G_USER_ID,
	               last_update_login       = G_LOGIN_ID
                WHERE  sr_contact_point_id = p_from_id
                  AND  party_id            = p_from_fk_id
                RETURNING incident_id , sr_contact_point_id BULK COLLECT
                 INTO l_incident_id , l_sr_contact_point_id ;
Line: 1435

                              p_updated_entity_code   	=> 'SR_CONTACT_POINT',
                              p_updated_entity_id     	=> l_sr_contact_point_id(i) ,
                              p_entity_update_date    	=> sysdate ,
                              p_entity_activity_code  	=> 'U',
                              p_update_program_code     => 'PARTY_MERGE',
                              x_audit_id             	=> l_audit_id ,
                              x_return_status        	=> l_return_status ,
                              x_msg_count            	=> x_msg_count ,
                              x_msg_data            	=> x_msg_data  ) ;
Line: 1454

                 UPDATE CS_HZ_SR_CONTACT_POINTS
                 SET    party_id              = p_to_fk_id,
			object_version_number = object_version_number + 1,
	                last_update_date      = SYSDATE,
	                last_updated_by       = G_USER_ID,
	                last_update_login     = G_LOGIN_ID,
                        primary_flag          = 'Y'
                 WHERE  sr_contact_point_id   = p_from_id
                   AND  party_id              = p_from_fk_id
                 RETURNING incident_id , sr_contact_point_id BULK COLLECT
                 INTO l_incident_id , l_sr_contact_point_id ;
Line: 1511

                                   p_updated_entity_code   	=> 'SR_CONTACT_POINT',
                                   p_updated_entity_id     	=> l_sr_contact_point_id(i) ,
                                   p_entity_update_date    	=> sysdate ,
                                   p_entity_activity_code  	=> 'U',
                                   p_update_program_code     => 'PARTY_MERGE',
                                   x_audit_id             	=> l_audit_id ,
                                   x_return_status        	=> l_return_status ,
                                   x_msg_count            	=> x_msg_count ,
                                   x_msg_data            	=> x_msg_data  ) ;
Line: 1533

         arp_message.set_name('AR', 'AR_ROWS_UPDATED');
Line: 1583

   SELECT 1
   FROM   cs_hz_sr_contact_points
   WHERE  sr_contact_point_id = p_from_id
   AND    contact_point_id = p_from_fk_id
   AND    contact_type <> 'EMPLOYEE'
   FOR    UPDATE NOWAIT;
Line: 1613

   SELECT merge_reason_code
     INTO l_merge_reason_code
     FROM hz_merge_batch
    WHERE batch_id  = p_batch_id;
Line: 1650

	    -- obtain lock on records to be updated.
         arp_message.set_name('AR', 'AR_LOCKING_TABLE');
Line: 1664

            select sr_contact_point_id INTO v_merged_to_id
            from   cs_hz_sr_contact_points
            where  contact_point_id          = p_to_fk_id
	    and    ( party_id, incident_id ) = ( select party_id, incident_id
						 from   cs_hz_sr_contact_points
						 where  sr_contact_point_id = p_from_id )
            and   sr_contact_point_id <> p_from_id
            and   contact_type <> 'EMPLOYEE'
	    and   rownum              = 1;
Line: 1689

            UPDATE CS_HZ_SR_CONTACT_POINTS
               SET contact_point_id      = p_to_fk_id,
		   object_version_number = object_version_number + 1,
	           last_update_date      = SYSDATE,
	           last_updated_by       = G_USER_ID,
	           last_update_login     = G_LOGIN_ID
             WHERE sr_contact_point_id   = p_from_id
               AND contact_point_id      = p_from_fk_id
            RETURNING incident_id , sr_contact_point_id BULK COLLECT
                 INTO l_incident_id , l_sr_contact_point_id ;
Line: 1744

                              p_updated_entity_code   	=> 'SR_CONTACT_POINT',
                              p_updated_entity_id     	=> l_sr_contact_point_id(i) ,
                              p_entity_update_date    	=> sysdate ,
                              p_entity_activity_code  	=> 'U',
                              p_update_program_code     => 'PARTY_MERGE',
                              x_audit_id             	=> l_audit_id ,
                              x_return_status        	=> l_return_status ,
                              x_msg_count            	=> x_msg_count ,
                              x_msg_data            	=> x_msg_data  ) ;
Line: 1763

	    --HEnce, mark the the other found record as duplicate and update the current
	    --one which needs to updated with the new party id. WHile marking the record
	    --as DUPLICATE, check if it is the PRIMARY CONTACT. IF so, make the current one
	    --which is going to be updated with new party id,  as PRIMARY CONTACT

            --Found a record which would result in duplicate. hence delete it
	    ---dbms_output.put_line('merged id is not null');
Line: 1771

            DELETE FROM CS_HZ_SR_CONTACT_POINTS
            WHERE SR_CONTACT_POINT_ID = v_merged_to_id
            RETURNING primary_flag INTO l_primary_flag ;
Line: 1778

               UPDATE CS_HZ_SR_CONTACT_POINTS
                  SET contact_point_id      = p_to_fk_id,
		      object_version_number = object_version_number + 1,
	              last_update_date      = SYSDATE,
	              last_updated_by       = G_USER_ID,
	              last_update_login     = G_LOGIN_ID
                WHERE sr_contact_point_id   = p_from_id
                  AND contact_point_id      = p_from_fk_id
                  RETURNING incident_id , sr_contact_point_id BULK COLLECT
                 INTO l_incident_id , l_sr_contact_point_id ;
Line: 1831

                                p_updated_entity_code     => 'SR_CONTACT_POINT',
                                p_updated_entity_id       => l_sr_contact_point_id(i) ,
                                p_entity_update_date      => sysdate ,
                                p_entity_activity_code    => 'U',
                                p_update_program_code     => 'PARTY_MERGE',
                                x_audit_id                => l_audit_id ,
                                x_return_status           => l_return_status ,
                                x_msg_count               => x_msg_count ,
                                x_msg_data                => x_msg_data  ) ;
Line: 1848

	       --PRIMARY_FLAG of the deleted record was Y, hence make this record as primary
	       ---dbms_output.put_line('primary flag is Y');
Line: 1850

               UPDATE CS_HZ_SR_CONTACT_POINTS
                  SET contact_point_id      = p_to_fk_id,
	              object_version_number = object_version_number + 1,
	              last_update_date      = SYSDATE,
	              last_updated_by       = G_USER_ID,
	              last_update_login     = G_LOGIN_ID,
                      primary_flag          = 'Y'
                WHERE sr_contact_point_id = p_from_id
                  AND contact_point_id    = p_from_fk_id
                  RETURNING incident_id , sr_contact_point_id BULK COLLECT
                 INTO l_incident_id , l_sr_contact_point_id ;
Line: 1905

                                p_updated_entity_code     => 'SR_CONTACT_POINT',
                                p_updated_entity_id       => l_sr_contact_point_id(i) ,
                                p_entity_update_date      => sysdate ,
                                p_entity_activity_code    => 'U',
                                p_update_program_code     => 'PARTY_MERGE',
                                x_audit_id                => l_audit_id ,
                                x_return_status           => l_return_status ,
                                x_msg_count               => x_msg_count ,
                                x_msg_data                => x_msg_data  ) ;
Line: 1927

         arp_message.set_name('AR', 'AR_ROWS_UPDATED');
Line: 1979

   SELECT rowid,
          incident_id ,
          customer_phone_id ,
          customer_email_id ,
          last_update_program_code
     FROM cs_incidents_all_b
    WHERE p_from_fk_id IN ( customer_phone_id, customer_email_id )
      FOR update nowait;
Line: 1996

   l_last_update_program_code   VARCHAR2_30_TBL;
Line: 2011

   SELECT merge_reason_code
     INTO l_merge_reason_code
     FROM hz_merge_batch
    WHERE batch_id  = p_batch_id;
Line: 2040

	 -- obtain lock on records to be updated.
         arp_message.set_name('AR', 'AR_LOCKING_TABLE');
Line: 2051

               l_last_update_program_code
         LIMIT 1000 ;
Line: 2068

	 UPDATE cs_incidents_all_b
	    SET customer_phone_id           = decode(customer_phone_id, p_from_fk_id, p_to_fk_id,
								  customer_phone_id ),
	        customer_email_id           = decode(customer_email_id, p_from_fk_id, p_to_fk_id,
								  customer_email_id ),
                incident_last_modified_date = sysdate ,
                last_update_program_code    = 'PARTY_MERGE',
		object_version_number       = object_version_number + 1,
	        last_update_date            = SYSDATE,
	        last_updated_by             = G_USER_ID,
	        last_update_login           = G_LOGIN_ID
         WHERE  rowid = l_rowid_tbl(i);
Line: 2083

         arp_message.set_name('AR', 'AR_ROWS_UPDATED');
Line: 2125

              l_audit_vals_rec. last_update_program_code    := 'PARTY_MERGE' ;
Line: 2126

	      l_audit_vals_rec.old_last_update_program_code := l_last_update_program_code (i);
Line: 2127

              l_audit_vals_rec.updated_entity_code          := 'SR_HEADER';
Line: 2128

              l_audit_vals_rec.updated_entity_id            := l_incident_id(i);
Line: 2143

                         p_last_update_date    => SYSDATE,
                         p_creation_date       => SYSDATE,
                         p_comments            => NULL,
                         x_audit_id            => l_audit_id);