DBA Data[Home] [Help]

APPS.PO_SOURCING_RULES_SV SQL Statements

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

Line: 108

PROCEDURE create_update_sourcing_rule  (
                   p_interface_header_id 	IN 	NUMBER,
                   p_interface_line_id     	IN 	NUMBER,
                   p_item_id               	IN 	NUMBER,
                   p_vendor_id             	IN 	NUMBER,
                   p_po_header_id          	IN 	NUMBER,
                   p_po_line_id            	IN 	NUMBER,
                   p_document_type         	IN 	VARCHAR2,
                   p_approval_status       	IN 	VARCHAR2,
                   p_rule_name             	IN 	VARCHAR2,
                   p_rule_name_prefix           IN 	VARCHAR2,
                   p_start_date            	IN 	DATE,
                   p_end_date              	IN 	DATE,
                   p_create_update_code    	IN 	VARCHAR2,
                   p_organization_id            IN 	NUMBER,
                   p_assignment_type_id    	IN 	NUMBER,
 		           p_po_interface_error_code 	IN 	VARCHAR2,
                   x_header_processable_flag    IN OUT NOCOPY VARCHAR2,
                   x_return_status   	OUT NOCOPY VARCHAR2,
----
                   p_assignment_set_id  IN NUMBER DEFAULT NULL,
                   p_vendor_site_id     IN NUMBER DEFAULT NULL
----
                   ) IS

X_process_flag              varchar2(1) := 'Y';
Line: 184

		((p_create_update_code = 'CREATE')
			OR (p_create_update_code ='CREATE_UPDATE'))) THEN
  		IF (g_po_pdoi_write_to_file = 'Y') THEN
     		PO_DEBUG.put_line(' Creating call rule for the item ...');
Line: 215

	END IF; -- p_create_update_code is create
Line: 219

			 (p_create_update_code ='CREATE_UPDATE')) THEN

		--validate to throw errors on some sure overlap failure cases
		PO_SOURCING_RULES_SV.validate_update_sourcing_rule(
               	x_interface_header_id 	 =>p_interface_header_id,
               	x_interface_line_id      =>p_interface_line_id,
                x_sourcing_rule_id		 =>x_sourcing_rule_id,
               	x_start_date             =>p_start_date,
               	x_end_date		         =>p_end_date,
               	x_assignment_type_id 	 =>p_assignment_type_id,
               	x_organization_id        =>p_organization_id,
               	x_assignment_set_id      =>x_assignment_set_id,
               	x_process_flag           =>x_process_flag,
               	x_running_status         =>l_running_status,
               	x_header_processable_flag =>x_header_processable_flag,
               	x_po_interface_error_code =>p_po_interface_error_code);
Line: 237

                PO_SOURCING_RULES_SV.update_sourcing_rule(
                        x_interface_header_id  =>p_interface_header_id,
                        x_interface_line_id    =>p_interface_line_id,
                        x_item_id              =>p_item_id,
                        x_vendor_id            =>p_vendor_id,
                        x_po_header_id 	       =>p_po_header_id,
                        x_po_line_id          =>p_po_line_id,
                        x_document_type        =>p_document_type,
                        x_sourcing_rule_id     =>x_sourcing_rule_id,
                        x_temp_sourcing_rule_id	=>x_temp_sourcing_rule_id,
                        x_start_Date           =>p_start_Date,
                        x_end_date             =>p_end_date,
                        x_organization_id      =>p_organization_id,
                        x_assignment_type_id   =>p_assignment_type_id,
                        x_assignment_set_id    =>x_assignment_set_id,
                        x_running_status       =>l_running_status,
                        x_header_processable_flag =>x_header_processable_flag,
                 	    x_po_interface_error_code =>p_po_interface_error_code,
----
                        p_vendor_site_id         =>p_vendor_site_id
----
                        );
Line: 260

	END IF;  -- X_create_update_flag is update
Line: 275

	po_message_s.sql_error('create_update_sourcing_rule', x_progress, sqlcode);
Line: 276

END create_update_sourcing_rule;
Line: 317

x_last_update_date          date := sysdate;
Line: 318

x_last_updated_by           number := fnd_global.user_id ;
Line: 321

x_last_update_login         number := fnd_global.user_id;
Line: 419

             select sourcing_rule_id into X_temp_sourcing_rule_id
             from mrp_sourcing_rules where
             sourcing_rule_name = X_rule_name and
             sourcing_rule_type =l_sourcing_rule_type and     ----
             nvl(organization_id,-999) = nvl(l_organization_id,-999);      ----
Line: 427

          the code flow was failing.We have to update both x_temp_sourcing_rule_id and x_sourcing_rule id with the same value.*/
           x_sourcing_rule_id := X_temp_sourcing_rule_id;--bug 12755392
Line: 444

         SELECT /*+ INDEX(MRP_SR_ASSIGNMENTS MRP_SR_ASSIGNMENTS_N3) */
                 sourcing_rule_id
         INTO    x_sourcing_rule_id
         FROM    mrp_sr_assignments
         WHERE   inventory_item_id = X_item_id
         AND     assignment_set_id = x_assignment_set_id
         AND sourcing_rule_type =l_sourcing_rule_type
         AND assignment_type=nvl(x_assignment_type_id,3)
         AND decode(x_assignment_type_id,6,organization_id,-1)=decode(x_assignment_type_id,6,l_organization_id,-1);
Line: 463

             PO_DEBUG.put_line(' Inserting Record in Mrp Sourcing Rules');
Line: 466

          SELECT  MRP_SOURCING_RULES_S.NEXTVAL
          INTO    x_sourcing_rule_id
          FROM    SYS.DUAL;
Line: 470

          INSERT INTO MRP_SOURCING_RULES(
                sourcing_rule_id,
                sourcing_rule_name,
                status,
                sourcing_rule_type,
        		organization_id,
                last_update_date,
                last_updated_by,
                creation_date,
                created_by,
                last_update_login,
                planning_active
                ) VALUES (
                x_sourcing_rule_id,
                nvl(X_rule_name,nvl(X_rule_name_prefix,'PURCH')||'_'||to_char(x_sourcing_rule_id)),----/* 8867481 */
                1,                      -- status
                l_sourcing_rule_type,  --
       		    l_organization_id, --
                x_last_update_date,
                x_last_updated_by,
                x_creation_date,
                x_created_by,
                x_last_update_login,
                1                       -- planning_active (1=ACTIVE)
          );
Line: 497

            PO_DEBUG.put_line(' Inserting Record in Mrp Sr Receipt Org');
Line: 500

         SELECT  MRP_SR_RECEIPT_ORG_S.NEXTVAL
         INTO    x_sr_receipt_id
         FROM    SYS.DUAL;
Line: 506

        INSERT INTO MRP_SR_RECEIPT_ORG(
                sr_receipt_id,
                sourcing_rule_id,
                effective_date,
                disable_date,
                last_update_date,
                last_updated_by,
                creation_date,
                created_by,
                last_update_login,
                receipt_organization_id----
        ) VALUES (
                x_sr_receipt_id,
                x_sourcing_rule_id,
                x_start_date,
                x_end_date,
                x_last_update_date,
                x_last_updated_by,
                x_creation_date,
                x_created_by,
                x_last_update_login,
                l_organization_id----
        );
Line: 531

           PO_DEBUG.put_line(' Inserting Record in Mrp Sr Source Org');
Line: 535

        SELECT  MRP_SR_SOURCE_ORG_S.NEXTVAL
        INTO    x_sr_source_id
        FROM    SYS.DUAL;
Line: 540

        INSERT INTO MRP_SR_SOURCE_ORG(
                sr_source_id,
                sr_receipt_id,
                vendor_id,
                vendor_site_id,
                source_type,
                allocation_percent,
                rank,
                last_update_date,
                last_updated_by,
                creation_date,
                created_by,
                last_update_login
        ) VALUES (
                x_sr_source_id,
                x_sr_receipt_id,
                x_vendor_id,
                x_vendor_site_id,
                3,              -- source_type
                100,            -- bug 605898, allocation_percent should be 100 instead of 0
                1,              -- rank should be 1
                x_last_update_date,
                x_last_updated_by,
                x_creation_date,
                x_created_by,
                x_last_update_login
        );
Line: 583

              SELECT 'Item Exists'
                INTO l_item_exists
                FROM mtl_system_items
               WHERE inventory_item_id = x_item_id
                 AND organization_id = l_inv_org_id;
Line: 592

                      PO_DEBUG.put_line('Cannot create ASL entry; item not defined in inv org. Insert warning msg');
Line: 626

        SELECT  MRP_SR_ASSIGNMENTS_S.NEXTVAL
        INTO    x_assignment_id
        FROM    SYS.DUAL;
Line: 630

        INSERT INTO MRP_SR_ASSIGNMENTS(
                assignment_id,
                assignment_type,
                sourcing_rule_id,
                sourcing_rule_type,
                assignment_set_id,
                last_update_date,
                last_updated_by,
                creation_date,
                created_by,
                last_update_login,
                organization_id,
                inventory_item_id
        ) VALUES (
                x_assignment_id,
                NVL(x_assignment_type_id,3), ----
                x_sourcing_rule_id,
                l_sourcing_rule_type,                      -- sourcing_rule_type (1=SOURCING RULE)
                x_assignment_set_id,
                x_last_update_date,
                x_last_updated_by,
                x_creation_date,
                x_created_by,
                x_last_update_login,
                -- Bug 3692799: organization_id should be null
		-- when assignment_type is 3 (item assignment)
                l_organization_id, ----
                x_item_id
        );
Line: 662

	 * This will prevent us to call the update_sourcing_rule
	 * procedure.
	*/
	x_process_flag := 'N';
Line: 701

PROCEDURE update_sourcing_rule  (X_interface_header_id   IN NUMBER,
                                     X_interface_line_id     IN NUMBER,
                                     X_item_id               IN NUMBER,
                                     X_vendor_id             IN NUMBER,
                                     X_po_header_id          IN NUMBER,
                                     X_po_line_id            IN NUMBER,
                                     X_document_type         IN VARCHAR2,
                                     x_sourcing_rule_id      IN NUMBER,
				                     x_temp_sourcing_rule_id IN NUMBER,
                                     X_start_date            IN DATE,
                                     X_end_date              IN DATE,
                		             X_organization_id	     IN NUMBER,
                		             X_assignment_type_id    IN NUMBER,
                			         x_assignment_set_id     IN NUMBER,
			                         X_running_status IN OUT NOCOPY VARCHAR2, --
                                     X_header_processable_flag IN OUT NOCOPY VARCHAR2,
			                         X_po_interface_error_code IN VARCHAR2,
----
                                     p_vendor_site_id     IN NUMBER DEFAULT NULL
----

                                     ) IS

X_progress      VARCHAR2(3) := NULL;
Line: 738

x_last_update_date          date := sysdate;
Line: 739

x_last_updated_by           number := fnd_global.user_id ;
Line: 742

x_last_update_login         number := fnd_global.user_id;
Line: 750

   /* This select statement first finds out if the combination of X_item_id and
   X_vendor_id already exists in PO_AUTOSOURCE_VENDORS */

   /* cursor c1 is to make sure if we can find the exact
      match in the sourcing rule effectivity dates */

   cursor C1 is
          SELECT sr_receipt_id
          FROM mrp_sr_receipt_org msro,
               mrp_sourcing_rules msr
          WHERE msr.sourcing_rule_id = msro.sourcing_rule_id
          AND   msr.sourcing_rule_id = x_sourcing_rule_id
          AND  trunc(nvl(msro.effective_date,x_start_date)) = trunc(x_start_date)--bug 12755392
         --added trunc and NVL condition
          AND   trunc(NVL(msro.disable_date,x_end_date)) = trunc(x_end_date);--bug 12755392
Line: 785

          SELECT sr_receipt_id, msro.effective_date, msro.disable_date
          FROM mrp_sr_receipt_org msro,
               mrp_sourcing_rules msr
          WHERE msr.sourcing_rule_id = msro.sourcing_rule_id
          AND   msr.sourcing_rule_id = x_sourcing_rule_id
          AND   (trunc(nvl(msro.effective_date,x_start_date)) between  trunc(x_start_date) and
                                                     trunc(x_end_date)--bug 12755392 added NVL on effective date
                OR   trunc(NVL(msro.disable_date,x_end_date)) between
                                                     trunc(x_start_date) and
                                                     trunc(x_end_date));--bug 12755392 in NVL for disable_date,
Line: 852

       select sourcing_rule_name, organization_id
        into  x_sourcing_name, x_org
       from mrp_sourcing_rules
       where sourcing_rule_id = x_sourcing_rule_id;
Line: 922

        SELECT count(*) into x_within_vendor_cnt
        FROM
        mrp_sr_receipt_org msro,
        mrp_sourcing_rules msr,
        mrp_sr_source_org msso
        WHERE   msr.sourcing_rule_id = msro.sourcing_rule_id
        AND   msro.sr_receipt_id = msso.sr_receipt_id
        AND   msr.sourcing_rule_id = x_sourcing_rule_id
        AND   trunc(x_start_date) between trunc(nvl(msro.effective_date,x_start_date)) and trunc(nvl(msro.disable_date,x_end_date))-- bug 12755392
        AND   trunc(x_end_date) between trunc(nvl(msro.effective_date,x_start_date)) and trunc(nvl(msro.disable_date,x_end_date))--bug 12755392
        AND   msso.vendor_id        = x_vendor_id
        AND   (msso.vendor_site_id   = x_vendor_site_id or
              (msso.vendor_site_id is NULL and x_vendor_site_id is null));
Line: 940

       SELECT count(*)
       INTO x_assignment_count
       FROM mrp_sr_assignments
       WHERE sourcing_rule_id = x_sourcing_rule_id;
Line: 949

	SELECT count(*)
       INTO x_item_assignment_count
       FROM mrp_sr_assignments
       WHERE sourcing_rule_id = x_sourcing_rule_id
 /* Bug 2160710 solved. Added the below two 'AND' conditions */
       AND   inventory_item_id = X_item_id
       AND   assignment_set_id = X_assignment_set_id ;
Line: 964

	* is coming in irrespective of the vendor needs to updated.
	* Now we need to consider whether this sourcing rule is assigned
	* to any other item. We can update only if there is either no
	* assignment or if there is an assignment to an item, it should
	* be this item on the blanket in this assignment set. If not,
	* we should not be changing since this would mean that we are
	* updating a sourcing rule used by other planner. This check is
	* done by getting X_assignment_count which is the number of times
	* this sourcing rule is assigned to any item in any assignment set.
	* x_item_assignment_count gets the number of times it is assigned
	* to the item in the default assignment set(which can be 0 or 1).
	* If they are the same, then it means that this sourcing rule is
	* assigned only to this item in this assignment set only and
	* hence can be changed. FPH change
       */
       --IF (x_dummy_count > 0) and  (x_within_vendor_cnt = 0 ) THEN
       IF ((x_within_vendor_cnt = 0) AND
	   ((x_assignment_count > 1) OR
	    (x_assignment_count =1 and x_item_assignment_count <> 1 ))) THEN

          -- insert into  po interface errors

          IF (g_po_pdoi_write_to_file = 'Y') THEN
             PO_DEBUG.put_line(' The existing sourcing rule is assgned elsewhere and does not
                               match with the vendor provided in the blanket');
Line: 1062

		    --to update its date.

			SELECT COUNT(*)
			INTO   x_vendor_count
			FROM   mrp_sr_source_org
			WHERE  sr_receipt_id = x_sr_receipt_id
			       AND ( ( vendor_id <> x_vendor_id )
				      OR ( ( vendor_id = x_vendor_id )
					   AND ( ( x_vendor_site_id IS NOT NULL
						   AND x_vendor_site_id <> vendor_site_id -- Changed from = to <> for the bug 12591815
						   AND x_vendor_site_id NOT IN (SELECT vendor_site_id
										FROM po_ga_org_assignments
										WHERE po_header_id = x_po_header_id)
						  )
						  OR ( x_vendor_site_id IS NULL
						       AND vendor_site_id IS NULL ))));
Line: 1105

                          select count(*)
                            into x_cnt_srdate
                            from mrp_sr_receipt_org
                            where x_end_date between
                                  effective_date and disable_date
                              and sourcing_rule_id = x_sourcing_rule_id
			      and sr_receipt_id <> x_sr_receipt_id;
Line: 1132

                              /* Update the Effective End date   */

                             if (x_start_date = x_effective_date) then

        	    	  	X_progress := '070';
Line: 1137

                                update mrp_sr_receipt_org
                                  set disable_date = x_end_date
                                 where sr_receipt_id = x_sr_receipt_id;
Line: 1143

                               /* Update the current record's disable date
                                  to start date - 1  */

                                 update mrp_sr_receipt_org
                                   set disable_date = x_start_date - 1
                                  where sr_receipt_id = x_sr_receipt_id;
Line: 1160

                                 SELECT  MRP_SR_RECEIPT_ORG_S.NEXTVAL
                                   INTO    x_sr_receipt_id
                                   FROM    SYS.DUAL;
Line: 1164

                                 INSERT INTO MRP_SR_RECEIPT_ORG(
                                    sr_receipt_id,
                                    sourcing_rule_id,
                                    effective_date,
                                    disable_date,
                                    last_update_date,
                                    last_updated_by,
                                    creation_date,
                                    created_by,
                                    last_update_login,
                                    receipt_organization_id----
                                  )
                                 VALUES (
                                    x_sr_receipt_id,
                                    x_sourcing_rule_id,
                                    x_start_date,
                                    x_end_date,
                                    x_last_update_date,
                                    x_last_updated_by,
                                    x_creation_date,
                                    x_created_by,
                                    x_last_update_login,
                                    l_organization_id----
                                    );
Line: 1191

                                  SELECT  MRP_SR_SOURCE_ORG_S.NEXTVAL
                                    INTO    x_sr_source_id
                                    FROM    SYS.DUAL;
Line: 1195

                                  SELECT nvl(max(rank),0) +1
                                    INTO   x_vendor_rank
                                    FROM   MRP_SR_SOURCE_ORG MSSO
                                    WHERE  sr_receipt_id = x_sr_receipt_id;
Line: 1200

                                  INSERT INTO MRP_SR_SOURCE_ORG(
                                   sr_source_id,
                                   sr_receipt_id,
                                   vendor_id,
                                   vendor_site_id,
                                   source_type,
                                   allocation_percent,
                                   rank,
                                   last_update_date,
                                   last_updated_by,
                                   creation_date,
                                   created_by,
                                   last_update_login )
                                 VALUES (
                                   x_sr_source_id,
                                   x_sr_receipt_id,
                                   x_vendor_id,
                                   x_vendor_site_id,
                                   3,         -- source_type
                                   100,
                                   x_vendor_rank,
                                   x_last_update_date,
                                   x_last_updated_by,
                                   x_creation_date,
                                   x_created_by,
                                   x_last_update_login );
Line: 1241

             insert into mrp_sr_receipt_org */

             IF (g_po_pdoi_write_to_file = 'Y') THEN
                PO_DEBUG.put_line(' Check to see if the effectivity dates of new sourcing rule falls within the existing sourcing rules effectivity dates');
Line: 1249

                PO_DEBUG.put_line(' Inserting Record MSRO for existing rule');
Line: 1253

             SELECT count(*) into x_sourcing_rule_within
               FROM mrp_sr_receipt_org msro,
                    mrp_sourcing_rules msr
               WHERE msr.sourcing_rule_id = msro.sourcing_rule_id
                 AND   msr.sourcing_rule_id = x_sourcing_rule_id
                 AND   x_start_date between msro.effective_date and msro.disable_date
                 AND   x_end_date between msro.effective_date and msro.disable_date;
Line: 1263

                 SELECT  MRP_SR_RECEIPT_ORG_S.NEXTVAL
                   INTO    x_sr_receipt_id
                   FROM    SYS.DUAL;
Line: 1268

                 INSERT INTO MRP_SR_RECEIPT_ORG(
                  sr_receipt_id,
                  sourcing_rule_id,
                  effective_date,
                  disable_date,
                  last_update_date,
                  last_updated_by,
                  creation_date,
                  created_by,
                  last_update_login,
                  receipt_organization_id   ----
                  )
                  VALUES (
                  x_sr_receipt_id,
                  x_sourcing_rule_id,
                  x_start_date,
                  x_end_date,
                  x_last_update_date,
                  x_last_updated_by,
                  x_creation_date,
                  x_created_by,
                  x_last_update_login,
                  l_organization_id----
                   );
Line: 1295

                  SELECT  MRP_SR_SOURCE_ORG_S.NEXTVAL
                    INTO    x_sr_source_id
                    FROM    SYS.DUAL;
Line: 1299

                  SELECT nvl(max(rank),0) +1
                    INTO   x_vendor_rank
                    FROM   MRP_SR_SOURCE_ORG MSSO
                    WHERE  sr_receipt_id = x_sr_receipt_id;
Line: 1306

                      PO_DEBUG.put_line(' Inserting Record MSSO for existing rule');
Line: 1309

                  INSERT INTO MRP_SR_SOURCE_ORG(
                    sr_source_id,
                    sr_receipt_id,
                    vendor_id,
                    vendor_site_id,
                    source_type,
                    allocation_percent,
                    rank,
                    last_update_date,
                    last_updated_by,
                    creation_date,
                    created_by,
                    last_update_login
                    )
                   VALUES (
                    x_sr_source_id,
                    x_sr_receipt_id,
                    x_vendor_id,
                    x_vendor_site_id,
                    3,              -- source_type
                    100,
                    x_vendor_rank,
                    x_last_update_date,
                    x_last_updated_by,
                    x_creation_date,
                    x_created_by,
                    x_last_update_login
                          );
Line: 1355

                       SELECT count(*)
                       INTO x_vendor_count_on_sr
                       FROM mrp_sr_source_org msso
                       WHERE
                            sr_receipt_id    = x_sr_receipt_id
                       AND  vendor_id        = x_vendor_id
                       AND  (vendor_site_id   = x_vendor_site_id
                        OR (vendor_site_id is NULL
                                AND x_vendor_site_id is NULL));
Line: 1379

                           SELECT  MRP_SR_SOURCE_ORG_S.NEXTVAL
                              INTO    x_sr_source_id
                           FROM    SYS.DUAL;
Line: 1387

                           /*SELECT nvl(max(rank),0) +1
                           INTO   x_vendor_rank
                           FROM   MRP_SR_SOURCE_ORG MSSO
                           WHERE  sr_receipt_id = x_sr_receipt_id;
Line: 1396

                           Update Mrp_Sr_Source_Org
                              Set Rank = Rank + 1
                            Where Sr_Receipt_Id = X_Sr_Receipt_Id;
Line: 1410

                           INSERT INTO MRP_SR_SOURCE_ORG(
                                   sr_source_id,
                                   sr_receipt_id,
                                   vendor_id,
                                   vendor_site_id,
                                   source_type,
                                   allocation_percent,
                                   rank,
                                   last_update_date,
                                   last_updated_by,
                                   creation_date,
                                   created_by,
                                   last_update_login
                           ) VALUES (
                                   x_sr_source_id,
                                   x_sr_receipt_id,
                                   x_vendor_id,
                                   x_vendor_site_id,
                                   3,              -- source_type
                                   100,            --bug9854697
                                   1,              --x_vendor_rank, --13961772
                                   x_last_update_date,
                                   x_last_updated_by,
                                   x_creation_date,
                                   x_created_by,
                                   x_last_update_login
                           );
Line: 1470

              SELECT 'Item Exists'
                INTO l_item_exists
                FROM mtl_system_items
               WHERE inventory_item_id = x_item_id
                 AND organization_id = l_inv_org_id;
Line: 1479

                      PO_DEBUG.put_line('Cannot create ASL entry; item not defined in inv org. Insert warning msg');
Line: 1511

        INSERT INTO MRP_SR_ASSIGNMENTS(
			assignment_id,
			assignment_type,
			sourcing_rule_id,
			sourcing_rule_type,
			assignment_set_id,
			last_update_date,
			last_updated_by,
			creation_date,
			created_by,
			last_update_login,
			organization_id,
			inventory_item_id
		)  select
		       MRP_SR_ASSIGNMENTS_S.NEXTVAL,
               nvl(x_assignment_type_id,3), ----
			x_sourcing_rule_id,
			l_sourcing_rule_type, ----
		       x_assignment_set_id,
			x_last_update_date,
			x_last_updated_by,
			x_creation_date,
			x_created_by,
			x_last_update_login,
			 -- Bug 3692799: organization_id should be null
			 -- when assignment_type is 3 (item assignment)
			l_organization_id, ----
            x_item_id
		  from dual where not exists
		  (select 'The item has to be attached to the assignment set' from
		   mrp_sr_assignments where
		   sourcing_rule_id=X_sourcing_rule_id --FPH
		   and inventory_item_id= X_item_id);
Line: 1557

	po_message_s.sql_error('update_sourcing_rule', x_progress, sqlcode);
Line: 1558

END update_sourcing_rule;
Line: 1717

PROCEDURE validate_update_sourcing_rule  (X_interface_header_id   IN NUMBER,
                     X_interface_line_id     IN NUMBER,
		     X_sourcing_rule_id      IN NUMBER,
                     X_start_date            IN DATE,
                     X_end_date              IN DATE,
		     X_assignment_type_id    IN NUMBER,
                     X_organization_id       IN NUMBER,
                     x_assignment_set_id     IN OUT NOCOPY NUMBER,
		     X_process_flag		 IN OUT NOCOPY VARCHAR2,
                     X_running_status	     IN OUT NOCOPY VARCHAR2, --
                     X_header_processable_flag IN OUT NOCOPY VARCHAR2,
		     X_po_interface_error_code IN VARCHAR2) IS
x_overlap_count				NUMBER:= 0;
Line: 1737

		SELECT count(*) into x_overlap_count
		FROM mrp_sr_receipt_org msro, mrp_sourcing_rules msr
		WHERE msr.sourcing_rule_id = msro.sourcing_rule_id
		AND   msr.sourcing_rule_id = x_sourcing_rule_id
		AND trunc(msro.effective_date) > trunc(x_start_date)
		AND (
				(trunc(NVL(msro.disable_date,sysdate)) between
					trunc(x_start_date) and  trunc(x_end_date)
				)
				or
				( trunc(x_end_date) between
					trunc(msro.effective_Date) and trunc(NVL(msro.disable_date,sysdate))
				)
			);
Line: 1756

	SELECT sourcing_rule_name, organization_id
	INTO x_sourcing_name, x_org
	FROM mrp_sourcing_rules
	WHERE sourcing_rule_id = x_sourcing_rule_id;
Line: 1788

END validate_update_sourcing_rule;