DBA Data[Home] [Help]

APPS.BOMPVALB SQL Statements

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

Line: 52

    CURSOR c1 is select
	organization_id OI, bill_sequence_id BSI,
	assembly_item_id AII, common_bill_sequence_id CBSI,
	common_assembly_item_id CAII, assembly_type AST,
	common_organization_id COI,
	alternate_bom_designator ABD, transaction_id TI
	from bom_bill_of_mtls_interface
	where process_flag = 2
        and rownum < 500;
Line: 77

           select organization_id
             into dummy_id
            from mtl_parameters
           where organization_id = c1rec.OI;
Line: 95

               update bom_bill_of_mtls_interface set
                       process_flag = 3
               where transaction_id = c1rec.TI;
Line: 108

              select 1
                into dummy_id
                from bom_alternate_designators
               where organization_id = c1rec.OI
                 and alternate_designator_code = c1rec.ABD;
Line: 127

                  update bom_bill_of_mtls_interface set
                          process_flag = 3
                  where transaction_id = c1rec.TI;
Line: 156

            update bom_bill_of_mtls_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 180

            update bom_bill_of_mtls_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 208

	    update bom_bill_of_mtls_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 242

	    update bom_bill_of_mtls_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 271

	    update bom_bill_of_mtls_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 302

                update bom_bill_of_mtls_interface set
                    process_flag = 3
                 where transaction_id = c1rec.TI;
Line: 336

	       update bom_bill_of_mtls_interface set
		       process_flag = 3
	       where transaction_id = c1rec.TI;
Line: 348

     update bom_bill_of_mtls_interface
        set process_flag = 4
      where transaction_id = c1rec.TI;
Line: 398

        select inventory_item_id
        into cnt
        from mtl_system_items
        where organization_id = org_id
        and   inventory_item_id = assy_id;
Line: 448

    	select bill_sequence_id
	into cnt
	from bom_bill_of_materials
	where bill_sequence_id = bom_seq_id;
Line: 470

    select count(*)
	into cnt
	from bom_bill_of_mtls_interface
	where bill_sequence_id = bom_seq_id
	and   process_flag = 4;
Line: 539

        select bill_sequence_id
	into cnt
	from bom_bill_of_materials
	where organization_id = org_id
	and   assembly_item_id = assy_id
	and   nvl(alternate_bom_designator, 'NONE') =
		nvl(alt_desg, 'NONE');
Line: 559

        select bill_sequence_id
	into cnt
	from bom_bill_of_mtls_interface
	where organization_id = org_id
	and   assembly_item_id = assy_id
	and   nvl(alternate_bom_designator, 'NONE') =
		nvl(alt_desg, 'NONE')
        and   rownum = 1
	and   process_flag = 4;
Line: 587

	    select bill_sequence_id
	    into cnt
	    from bom_bill_of_materials
	    where organization_id = org_id
	    and   assembly_item_id = assy_id
	    and   alternate_bom_designator is null
            and   ((assy_type = 2)
                  or
                   (assy_type =1 and assembly_type = 1)
                  );
Line: 607

	    select bill_sequence_id
	    into cnt
	    from bom_bill_of_mtls_interface
	    where organization_id = org_id
	    and   assembly_item_id = assy_id
	    and   alternate_bom_designator is null
            and   ((assy_type = 2)
                  or
                   (assy_type =1 and assembly_type = 1)
                  )
	    and   process_flag = 4
	    and   rownum = 1;
Line: 667

    select 1
       into cnt
       from mtl_system_items
      where organization_id = org_id
	and inventory_item_id = assy_id
	and bom_enabled_flag = 'Y'
	and ((assy_type = 2)
	     or
	     (assy_type = 1 and
              eng_item_flag = 'N')
	    );
Line: 744

        select 1
          into cnt
          from mtl_parameters mp1, mtl_parameters mp2
         where mp1.organization_id = org_id
           and mp2.organization_id = cmn_org_id
           and mp1.master_organization_id = mp2.master_organization_id;
Line: 767

        select bill_sequence_id
	into cnt
	from bom_bill_of_materials
	where bill_sequence_id = cmn_bom_id
        and   assembly_item_id = cmn_item_id
        and   organization_id  = cmn_org_id
	and   nvl(alternate_bom_designator, 'NONE') =
		nvl(alt_desg, 'NONE')
        and   common_bill_sequence_id = bill_sequence_id
        and   (assembly_item_id <> item_id
               or
               organization_id <> org_id
               )
	and   ((bom_type <> 1)
		or
  	       (bom_type = 1
		and
		assembly_type = 1
	       )
	      );
Line: 796

        select bill_sequence_id
	into cnt
	from bom_bill_of_mtls_interface
	where bill_sequence_id = cmn_bom_id
        and   assembly_item_id = cmn_item_id
        and   organization_id  = cmn_org_id
	and   nvl(alternate_bom_designator, 'NONE') =
		nvl(alt_desg, 'NONE')
        and   common_bill_sequence_id = bill_sequence_id
        and   (assembly_item_id <> item_id
               or
               organization_id <> org_id
               )
	and   process_flag = 4
	and   ((bom_type <> 1)
		or
  	       (bom_type = 1
		and
		assembly_type = 1
	       )
	      );
Line: 826

        select bom_item_type, base_item_id, replenish_to_order_flag,
               pick_components_flag
          into bit, base_id, ato, pto
          from mtl_system_items
         where inventory_item_id = item_id
           and organization_id = org_id;
Line: 833

        select count(*)
	    into cnt
	    from bom_inventory_components bic
	    where bic.bill_sequence_id = cmn_bom_id
              and NOT EXISTS
                 (SELECT 'x'
                    FROM MTL_SYSTEM_ITEMS S
                   WHERE S.ORGANIZATION_ID = org_id
                     AND S.INVENTORY_ITEM_ID = bic.COMPONENT_ITEM_ID
                     AND   ((bom_type = 1
                             AND S.ENG_ITEM_FLAG = 'N')
                            OR (bom_type = 2))
                     AND  S.BOM_ENABLED_FLAG = 'Y'
                     AND  S.INVENTORY_ITEM_ID <> item_id
                     AND ((bit = 1
                           AND S.BOM_ITEM_TYPE <> 3)
                         OR (bit = 2
                             AND S.BOM_ITEM_TYPE <> 3)
                         OR (bit = 3)
                         OR (bit = 4
                             AND (S.BOM_ITEM_TYPE = 4
                                 OR (S.BOM_ITEM_TYPE IN (2, 1)
                                     AND S.REPLENISH_TO_ORDER_FLAG = 'Y'
                                     AND base_id IS NOT NULL
                                     AND ato = 'Y')))
                             )
                     AND (bit = 3
                          OR
                          pto = 'Y'
                          OR
                          S.PICK_COMPONENTS_FLAG = 'N')
                     AND (bit = 3
                          OR
                          NVL(S.BOM_ITEM_TYPE, 4) <> 2
                          OR
                          (S.BOM_ITEM_TYPE = 2
                           AND ((pto = 'Y'
                                 AND S.PICK_COMPONENTS_FLAG = 'Y')
                               OR (ato = 'Y'
                                   AND S.REPLENISH_TO_ORDER_FLAG = 'Y'))))
                     AND NOT(bit = 4
                             AND pto = 'Y'
                             AND S.BOM_ITEM_TYPE = 4
                             AND S.REPLENISH_TO_ORDER_FLAG = 'Y')
	 	);
Line: 883

        select count(*)
	    into cnt
	    from bom_inventory_comps_interface bic
	    where bill_sequence_id = cmn_bom_id
	    and process_flag in (2, 4)
            and NOT EXISTS
                 (SELECT 'x'
                    FROM MTL_SYSTEM_ITEMS S
                   WHERE S.ORGANIZATION_ID = org_id
                     AND S.INVENTORY_ITEM_ID = bic.COMPONENT_ITEM_ID
                     AND   ((bom_type = 1
                             AND S.ENG_ITEM_FLAG = 'N')
                            OR (bom_type = 2))
                     AND  S.BOM_ENABLED_FLAG = 'Y'
                     AND  S.INVENTORY_ITEM_ID <> item_id
                     AND ((bit = 1
                           AND S.BOM_ITEM_TYPE <> 3)
                         OR (bit = 2
                             AND S.BOM_ITEM_TYPE <> 3)
                         OR (bit = 3)
                         OR (bit = 4
                             AND (S.BOM_ITEM_TYPE = 4
                                 OR (S.BOM_ITEM_TYPE IN (2, 1)
                                     AND S.REPLENISH_TO_ORDER_FLAG = 'Y'
                                     AND base_id IS NOT NULL
                                     AND ato = 'Y')))
                             )
                     AND (bit = 3
                          OR
                          pto = 'Y'
                          OR
                          S.PICK_COMPONENTS_FLAG = 'N')
                     AND (bit = 3
                          OR
                          NVL(S.BOM_ITEM_TYPE, 4) <> 2
                          OR
                          (S.BOM_ITEM_TYPE = 2
                           AND ((pto = 'Y'
                                 AND S.PICK_COMPONENTS_FLAG = 'Y')
                               OR (ato = 'Y'
                                   AND S.REPLENISH_TO_ORDER_FLAG = 'Y'))))
                     AND NOT(bit = 4
                             AND pto = 'Y'
                             AND S.BOM_ITEM_TYPE = 4
                             AND S.REPLENISH_TO_ORDER_FLAG = 'Y')
	 	);
Line: 939

        select count(*)
          into cnt
          from bom_inventory_components bic,
               bom_substitute_components bsc
         where bic.bill_sequence_id = cmn_bom_id
           and bic.component_sequence_id = bsc.component_sequence_id
           and bsc.substitute_component_id not in
               (select msi1.inventory_item_id
                  from mtl_system_items msi1, mtl_system_items msi2
                 where msi1.organization_id = org_id
                   and   msi1.inventory_item_id = bsc.substitute_component_id
                   and   msi2.organization_id = cmn_org_id
                   and   msi2.inventory_item_id = msi1.inventory_item_id);
Line: 956

        select count(*)              /* Comp and sub comp in interface */
            into cnt
            from bom_inventory_comps_interface bic,
                 bom_sub_comps_interface bsc
            where bic.bill_sequence_id = cmn_bom_id
            and bic.process_flag in (2, 4)
            and bsc.process_flag in (2, 4)
            and bic.component_sequence_id = bsc.component_sequence_id
            and bsc.substitute_component_id not in
                (select msi1.inventory_item_id
                   from mtl_system_items msi1, mtl_system_items msi2
                  where msi1.organization_id = org_id
                    and   msi1.inventory_item_id = bsc.substitute_component_id
                    and   msi2.organization_id = cmn_org_id
                    and   msi2.inventory_item_id = msi1.inventory_item_id);
Line: 975

        select count(*)   /* Comp in production and sub comp in interface */
            into cnt
            from bom_inventory_components bic,
                 bom_sub_comps_interface bsc
            where bic.bill_sequence_id = cmn_bom_id
            and bsc.process_flag in (2, 4)
            and bic.component_sequence_id = bsc.component_sequence_id
            and bsc.substitute_component_id not in
                (select msi1.inventory_item_id
                   from mtl_system_items msi1, mtl_system_items msi2
                  where msi1.organization_id = org_id
                    and   msi1.inventory_item_id = bsc.substitute_component_id
                    and   msi2.organization_id = cmn_org_id
                    and   msi2.inventory_item_id = msi1.inventory_item_id);
Line: 1002

    	select 1
	into cnt
	from mtl_system_items msi1, mtl_system_items msi2
	where msi1.organization_id = org_id
	and   msi1.inventory_item_id = item_id
	and   msi2.organization_id = cmn_org_id
	and   msi2.inventory_item_id = cmn_item_id
        and   msi2.bom_enabled_flag = 'Y'
	and   msi1.bom_item_type = msi2.bom_item_type
	and   msi1.pick_components_flag = msi2.pick_components_flag
	and   msi1.replenish_to_order_flag = msi2.replenish_to_order_flag;
Line: 1082

    update_comp         exception;
Line: 1085

	select component_sequence_id CSI, bill_sequence_id BSI,
		transaction_id TI,
                to_char(effectivity_date,'YYYY/MM/DD HH24:MI') ED,
                effectivity_date EDD,
		to_char(disable_date,'YYYY/MM/DD HH24:MI') DD,
                to_char(implementation_date,'YYYY/MM/DD HH24:MI') ID,
                operation_seq_num OSN, supply_locator_id SLI,
                supply_subinventory SS,
		msic.organization_id OI, component_item_id CII,
		assembly_item_id AII, alternate_bom_designator ABD,
		planning_factor PF, optional O, check_atp CATP,
		msic.atp_flag AF, so_basis SB, required_for_revenue RFR,
		required_to_ship RTS, mutually_exclusive_options MEO,
                low_quantity LQ, high_quantity HQ,
		quantity_related QR, include_in_cost_rollup ICR,
		shipping_allowed SA, include_on_ship_docs ISD,
                component_yield_factor CYF, ici.wip_supply_type WST,
		component_quantity CQ, msic.bom_item_type BITC,
		msic.pick_components_flag PCF, msia.bom_item_type BITA,
                msia.pick_components_flag PCFA,
		msia.replenish_to_order_flag RTOF,
		msic.replenish_to_order_flag RTOFC,
                msia.atp_components_flag ACF,
                msic.ato_forecast_control AFC
        from    mtl_system_items msic,
		mtl_system_items msia,
                bom_inventory_comps_interface ici
	where process_flag = 2
	and   msic.organization_id = ici.organization_id
        and   msia.organization_id = ici.organization_id
	and   msic.inventory_item_id = ici.component_item_id
	and   msia.inventory_item_id = ici.assembly_item_id;
Line: 1142

	    update bom_inventory_comps_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 1174

            update bom_inventory_comps_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 1204

	    update bom_inventory_comps_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 1238

	    update bom_inventory_comps_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 1254

	    select 'Is pointing to a common'
	    into dummy
	    from bom_bill_of_materials
	    where bill_sequence_id = c1rec.BSI
	    and   common_bill_sequence_id <> c1rec.BSI;
Line: 1272

            update bom_inventory_comps_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 1285

	    select 'Is pointing to a common'
	    into dummy
	    from bom_bill_of_mtls_interface
	    where bill_sequence_id = c1rec.BSI
            and   process_flag = 4
	    and   common_bill_sequence_id <> c1rec.BSI;
Line: 1304

            update bom_inventory_comps_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 1324

            select assembly_type
            from bom_bill_of_materials
            where bill_sequence_id = c1rec.BSI;
Line: 1328

           select assembly_type
             from bom_bill_of_mtls_interface
            where bill_sequence_id = c1rec.BSI
              and process_flag = 4;
Line: 1364

	    update bom_inventory_comps_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 1397

	    update bom_inventory_comps_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 1424

            update bom_inventory_comps_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 1463

	        update bom_inventory_comps_interface set
		    process_flag = 3
	        where transaction_id = c1rec.TI;
Line: 1492

                update bom_inventory_comps_interface set
                    process_flag = 3
                where transaction_id = c1rec.TI;
Line: 1508

	    update bom_inventory_comps_interface
	    set component_yield_factor = 1,
		check_atp = 2,
		include_on_ship_docs = 2,
		so_basis = 2,
		mutually_exclusive_options = 2,
		required_to_ship = 2,
		required_for_revenue = 2,
		low_quantity = NULL,
		high_quantity = NULL
	    where transaction_id = c1rec.TI;
Line: 1620

             select distinct 'I'
               into oe_install
               from fnd_product_installations
              where application_id = 300
		and status = 'I';
Line: 1648

            update bom_inventory_comps_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 1666

          raise update_comp;
Line: 1669

        select inventory_asset_flag,restrict_subinventories_code,
               restrict_locators_code, location_control_code
          into inv_asst, r_subinv, r_loc, loc_ctl
          from mtl_system_items
         where inventory_item_id = c1rec.CII
           and organization_id = c1rec.OI;
Line: 1712

               select locator_type
                 into sub_loc_code
                 from mtl_secondary_inventories
                where secondary_inventory_name = c1rec.SS
                  and organization_id = c1rec.OI
                  and nvl(disable_date,TRUNC(c1rec.EDD)+1) > TRUNC(c1rec.EDD)
                  and quantity_tracked = 1;
Line: 1725

               select locator_type
                 into sub_loc_code
                 from mtl_secondary_inventories
                where secondary_inventory_name = c1rec.SS
                  and organization_id = c1rec.OI
                  and nvl(disable_date,TRUNC(c1rec.EDD)+1) > TRUNC(c1rec.EDD)
                  and quantity_tracked = 1
                  and ((inv_asst = 'Y' and asset_inventory = 1)
                       or
                       (inv_asst = 'N')
                      );
Line: 1744

               select locator_type
                 into sub_loc_code
                 from mtl_secondary_inventories sub,
                      mtl_item_sub_inventories item
                where item.organization_id = sub.organization_id
                  and item.secondary_inventory = sub.secondary_inventory_name
                  and item.inventory_item_id = c1rec.CII
                  and sub.secondary_inventory_name = c1rec.SS
                  and sub.organization_id = c1rec.OI
                  and nvl(sub.disable_date,TRUNC(c1rec.EDD)+1) >
                      TRUNC(c1rec.EDD)
                  and sub.quantity_tracked = 1;
Line: 1762

               select locator_type
                 into sub_loc_code
                 from mtl_secondary_inventories sub,
                      mtl_item_sub_inventories item
                where item.organization_id = sub.organization_id
                  and item.secondary_inventory = sub.secondary_inventory_name
                  and item.inventory_item_id = c1rec.CII
                  and sub.secondary_inventory_name = c1rec.SS
                  and sub.organization_id = c1rec.OI
                  and nvl(sub.disable_date,TRUNC(c1rec.EDD)+1) >
                      TRUNC(c1rec.EDD)
                  and sub.quantity_tracked = 1
                  and ((inv_asst = 'Y' and sub.asset_inventory = 1)
                       or
                       (inv_asst = 'N')
                      );
Line: 1788

        select stock_locator_control_code
          into org_loc
          from mtl_parameters
         where organization_id = c1rec.OI;
Line: 1804

                 select 'loc exists'
                   into dummy
                   from mtl_item_locations
                  where inventory_location_id = c1rec.SLI
                    and organization_id = c1rec.OI
                    and subinventory_code = c1rec.SS
                   and nvl(disable_date,trunc(c1rec.EDD)+1) > trunc(c1rec.EDD);
Line: 1817

                 select 'restricted loc exists'
                   into dummy
                   from mtl_item_locations loc,
                        mtl_secondary_locators item
                  where loc.inventory_location_id = c1rec.SLI
                    and loc.organization_id = c1rec.OI
                    and loc.subinventory_code = c1rec.SS
                    and nvl(loc.disable_date,trunc(c1rec.EDD)+1) >
                        trunc(c1rec.EDD)
                    and loc.inventory_location_id = item.secondary_locator
                    and loc.organization_id = item.organization_id
                    and item.inventory_item_id = c1rec.CII;
Line: 1855

                        select 'loc exists'
                          into dummy
                          from mtl_item_locations
                         where inventory_location_id = c1rec.SLI
                           and organization_id = c1rec.OI
                           and subinventory_code = c1rec.SS
                           and nvl(disable_date,trunc(c1rec.EDD)+1) >
                               trunc(c1rec.EDD);
Line: 1869

                       select 'restricted loc exists'
                         into dummy
                         from mtl_item_locations loc,
                              mtl_secondary_locators item
                        where loc.inventory_location_id = c1rec.SLI
                         and loc.organization_id = c1rec.OI
                         and loc.subinventory_code = c1rec.SS
                         and nvl(loc.disable_date,trunc(c1rec.EDD)+1) >
                             trunc(c1rec.EDD)
                         and loc.inventory_location_id = item.secondary_locator
                         and loc.organization_id = item.organization_id
                         and item.inventory_item_id = c1rec.CII;
Line: 1909

                        select 'loc exists'
                          into dummy
                          from mtl_item_locations
                         where inventory_location_id = c1rec.SLI
                           and organization_id = c1rec.OI
                           and subinventory_code = c1rec.SS
                           and nvl(disable_date,trunc(c1rec.EDD)+1) >
                               trunc(c1rec.EDD);
Line: 1923

                       select 'restricted loc exists'
                         into dummy
                         from mtl_item_locations loc,
                              mtl_secondary_locators item
                        where loc.inventory_location_id = c1rec.SLI
                         and loc.organization_id = c1rec.OI
                         and loc.subinventory_code = c1rec.SS
                         and nvl(loc.disable_date,trunc(c1rec.EDD)+1) >
                             trunc(c1rec.EDD)
                         and loc.inventory_location_id = item.secondary_locator
                         and loc.organization_id = item.organization_id
                         and item.inventory_item_id = c1rec.CII;
Line: 1947

      raise update_comp;
Line: 1969

        update bom_inventory_comps_interface set
            process_flag = 3
        where transaction_id = c1rec.TI;
Line: 1990

        update bom_inventory_comps_interface set
            process_flag = 3
        where transaction_id = c1rec.TI;
Line: 1998

    when update_comp then
        update bom_inventory_comps_interface
           set process_flag = 4
         where transaction_id = c1rec.TI;
Line: 2074

    select 1
	into dummy
	from mtl_system_items assy, mtl_system_items comp
	where   comp.organization_id = org_id
	and     assy.organization_id = org_id
	and	comp.inventory_item_id = cmp_id
	and    	assy.inventory_item_id = assy_id
	and 	comp.bom_enabled_flag = 'Y'
        and	comp.inventory_item_id <> assy.inventory_item_id
        and     ((eng_bill = 1 and comp.eng_item_flag = 'N')
                  or
                 (eng_bill = 2))
        and	((assy.bom_item_type = 1 and comp.bom_item_type <> 3)
                 or
                 (assy.bom_item_type = 2 and comp.bom_item_type <> 3)
                 or
                 (assy.bom_item_type = 3)
                 or
                 (assy.bom_item_type = 4
                  and (comp.bom_item_type = 4
                       or (comp.bom_item_type in (2,1)
                           and comp.replenish_to_order_flag = 'Y'
                           and assy.base_item_id is not null
                           and assy.replenish_to_order_flag = 'Y')))
                )
                and (assy.bom_item_type = 3
                     or
                     assy.pick_components_flag = 'Y'
                     or
                     comp.pick_components_flag = 'N')
                and (assy.bom_item_type = 3
                     or
                     comp.bom_item_type <> 2
                     or
                     (comp.bom_item_type = 2
                      and ((assy.pick_components_flag = 'Y'
                            and comp.pick_components_flag = 'Y')
                           or (assy.replenish_to_order_flag = 'Y'
                               and comp.replenish_to_order_flag = 'Y'))))
                and not(assy.bom_item_type = 4
                        and assy.pick_components_flag = 'Y'
                        and comp.bom_item_type = 4
                        and comp.replenish_to_order_flag = 'Y');
Line: 2119

           select 1
             into dummy
             from mtl_system_items assy, mtl_system_items comp
            where   comp.organization_id = org_id
            and     assy.organization_id = org_id
            and     comp.inventory_item_id = cmp_id
            and     assy.inventory_item_id = assy_id
            and     (comp.atp_components_flag = 'Y' or
                     comp.atp_flag = 'Y')
            and     assy.atp_components_flag = 'N'
            and     (nvl(assy.wip_supply_type,1) = 6
                     or assy.replenish_to_order_flag = 'Y'
                     or assy.pick_components_flag = 'Y');
Line: 2177

    select bom_item_type
	into dummy
	from mtl_system_items
	where organization_id = org_id
	and   inventory_item_id = assy_id;
Line: 2189

        select operation_seq_num
	into dummy
	from bom_operation_sequences a, bom_operational_routings b
	where b.organization_id = org_id
	and   b.assembly_item_id = assy_id
	and   operation_seq_num = op_seq
	and   b.common_routing_sequence_id = a.routing_sequence_id
	and   ( (alt_desg is null and b.alternate_routing_designator is null)
		or
		(alt_desg is not null
		and
		  ( (b.alternate_routing_designator = alt_desg)
			or
		    (b.alternate_routing_designator is null
			and not exists (select 'No alt routing'
			from bom_operational_routings c
			where c.organization_id = org_id
			and   c.assembly_item_id = assy_id
			and   c.alternate_routing_designator = alt_desg)
		    )
		  )
		)
	      );
Line: 2255

    select count(*)
	into dummy
	from bom_inventory_components
	where bill_sequence_id = bom_id
	and   component_item_id = cmp_id
	and   operation_seq_num = op_num
	and   implementation_date is not null
        and   ((dis_date is null
                and to_date(eff_date,'YYYY/MM/DD HH24:MI') <
                  nvl(disable_date, to_date(eff_date,'YYYY/MM/DD HH24:MI') +1))
              or
               (dis_date is not null
                and to_date(dis_date,'YYYY/MM/DD HH24:MI') > effectivity_date
                and to_date(eff_date,'YYYY/MM/DD HH24:MI') <
                   nvl(disable_date,to_date(eff_date,'YYYY/MM/DD HH24:MI') +1))
              );
Line: 2275

    select count(*)
	into dummy
	from bom_inventory_comps_interface
	where bill_sequence_id = bom_id
        and   process_flag = 4
	and   component_item_id = cmp_id
	and   operation_seq_num = op_num
	and   implementation_date is not null
        and   ((dis_date is null
                and to_date(eff_date,'YYYY/MM/DD HH24:MI') <
                  nvl(disable_date, to_date(eff_date,'YYYY/MM/DD HH24:MI') +1))
              or
               (dis_date is not null
                and to_date(dis_date,'YYYY/MM/DD HH24:MI') > effectivity_date
                and to_date(eff_date,'YYYY/MM/DD HH24:MI') <
                   nvl(disable_date,to_date(eff_date,'YYYY/MM/DD HH24:MI') +1))
	      );
Line: 2338

	select 1
	    into dummy
	    from bom_inventory_components
	    where component_sequence_id = cmp_seq_id;
Line: 2360

    select count(*)
	into dummy
	from bom_inventory_comps_interface
	where component_sequence_id = cmp_seq_id
          and process_flag = 4;
Line: 2428

        select component_sequence_id
        into cnt
        from bom_inventory_components
        where bill_sequence_id = bill_seq_id
        and   to_char(effectivity_date,'YYYY/MM/DD HH24:MI') = eff_date
        and   component_item_id = cmp_item_id
        and   operation_seq_num = op_seq;
Line: 2448

        select component_sequence_id
        into cnt
        from bom_inventory_comps_interface
        where bill_sequence_id = bill_seq_id
        and   to_char(effectivity_date,'YYYY/MM/DD HH24:MI') = eff_date
        and   component_item_id = cmp_item_id
        and   operation_seq_num = op_seq
        and   rownum = 1
        and   process_flag = 4;
Line: 2517

	select component_sequence_id CSI, count(*) CNT,
		transaction_id TI, component_item_id CII
	 from bom_ref_desgs_interface
	where process_flag = 2
          and rownum < 500
	group by transaction_id, component_sequence_id, component_item_id;
Line: 2525

select count(distinct component_sequence_id)
  into total_recs
  from bom_ref_desgs_interface
 where process_flag = 2;
Line: 2539

        select count(*)
          into dummy
          from bom_ref_desgs_interface
         where transaction_id = c1rec.TI
           and component_reference_designator is null;
Line: 2560

       update bom_ref_desgs_interface set
             process_flag = 3
       where transaction_id = c1rec.TI;
Line: 2591

	    update bom_ref_desgs_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 2620

            update bom_ref_desgs_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 2650

            update bom_ref_desgs_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 2665

        select bbom.organization_id,
               bbom.assembly_item_id, bic.bom_item_type
          into org_id_dummy, assy_id_dummy, comp_type
          from bom_inventory_components bic,
               bom_bill_of_materials bbom
         where component_sequence_id = c1rec.CSI
           and bbom.bill_sequence_id = bic.bill_sequence_id;
Line: 2679

        select bbom.organization_id,
               bbom.assembly_item_id, bic.bom_item_type
          into org_id_dummy, assy_id_dummy, comp_type
          from bom_inventory_comps_interface bic,
               bom_bill_of_mtls_interface bbom
         where component_sequence_id = c1rec.CSI
           and bic.process_flag = 4
           and bbom.process_flag = 4
           and bbom.bill_sequence_id = bic.bill_sequence_id;
Line: 2695

        select bbom.organization_id,
               bbom.assembly_item_id, bic.bom_item_type
          into org_id_dummy, assy_id_dummy, comp_type
          from bom_inventory_comps_interface bic,
               bom_bill_of_materials bbom
         where component_sequence_id = c1rec.CSI
           and bic.process_flag = 4
           and bbom.bill_sequence_id = bic.bill_sequence_id;
Line: 2712

	select bom_item_type
	into dummy
	from mtl_system_items msi
	where msi.organization_id = org_id_dummy
	and   msi.inventory_item_id = assy_id_dummy;
Line: 2732

	    update bom_ref_desgs_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 2756

            update bom_ref_desgs_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 2766

        update bom_ref_desgs_interface
           set process_flag = 4
         where transaction_id = c1rec.TI;
Line: 2822

        select 1
        into dummy
        from bom_reference_designators a, bom_ref_desgs_interface b
        where b.transaction_id = trans_id
        and   a.component_sequence_id = b.component_sequence_id
        and   a.COMPONENT_REFERENCE_DESIGNATOR =
                b.COMPONENT_REFERENCE_DESIGNATOR
        and rownum = 1;
Line: 2844

    select count(*)
        into dummy
        from bom_ref_desgs_interface a
        where transaction_id = trans_id
        and   exists (select 'same designator'
                from bom_ref_desgs_interface b
                where b.transaction_id = trans_id
                and   b.rowid <> a.rowid
                and   b.COMPONENT_REFERENCE_DESIGNATOR =
                        a.COMPONENT_REFERENCE_DESIGNATOR
                and   b.process_flag <> 3
                and   b.process_flag <> 7)
        and   process_flag <> 3
        and   process_flag <> 7;
Line: 2902

        select QUANTITY_RELATED, COMPONENT_QUANTITY
        into   qty_flag, cmp_qty
        from bom_inventory_components
        where component_sequence_id = cmp_seq_id;
Line: 2923

** if no rows selected from prod table, then get from interface table
*/
    if (qty_flag <> 1 and qty_flag <> 2) then
        select QUANTITY_RELATED, COMPONENT_QUANTITY
        into   qty_flag, cmp_qty
        from bom_inventory_comps_interface
        where component_sequence_id = cmp_seq_id
          and process_flag = 4;
Line: 2934

        select count(*)
        into ref_qty
        from bom_reference_designators
        where component_sequencE_id = cmp_seq_id;
Line: 2939

        select count(*)
        into int_ref_qty
        from bom_ref_desgs_interface
        where transaction_id = trans_id
        and   process_flag <> 3
        and   process_flag <> 7;
Line: 3003

	select component_sequence_id CSI, count(*) CNT,
		transaction_id TI, assembly_item_id AII,
		organization_id OI
		from bom_sub_comps_interface
	where process_flag = 2
          and rownum < 500
	group by transaction_id, component_sequence_id,
		organization_id, assembly_item_id;
Line: 3013

select count(distinct component_sequence_id)
  into total_recs
  from bom_sub_comps_interface
 where process_flag = 2;
Line: 3043

	    update bom_sub_comps_interface set
		    process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 3058

        select bbom.assembly_item_id,bbom.organization_id,
               bbom.assembly_type, bic.component_item_id,
	       bic.bom_item_type
          into assy_id_dummy, org_id_dummy,assy_type_dummy,
               comp_id_dummy, comp_type
          from bom_inventory_components bic,
               bom_bill_of_materials bbom
         where component_sequence_id = c1rec.CSI
           and bbom.bill_sequence_id = bic.bill_sequence_id;
Line: 3074

        select bbom.assembly_item_id,bbom.organization_id,
               bbom.assembly_type, bic.component_item_id,
	       bic.bom_item_type
          into assy_id_dummy, org_id_dummy,assy_type_dummy,
               comp_id_dummy, comp_type
          from bom_inventory_comps_interface bic,
               bom_bill_of_mtls_interface bbom
         where component_sequence_id = c1rec.CSI
           and bic.process_flag = 4
           and bbom.process_flag = 4
           and bbom.bill_sequence_id = bic.bill_sequence_id;
Line: 3092

        select bbom.assembly_item_id,bbom.organization_id,
               bbom.assembly_type, bic.component_item_id,
	       bic.bom_item_type
          into assy_id_dummy, org_id_dummy,assy_type_dummy,
               comp_id_dummy, comp_type
          from bom_inventory_comps_interface bic,
               bom_bill_of_materials bbom
         where component_sequence_id = c1rec.CSI
           and bic.process_flag = 4
           and bbom.bill_sequence_id = bic.bill_sequence_id;
Line: 3111

     select bom_item_type
     into dummy
     from mtl_system_items msi
     where msi.organization_id = org_id_dummy
       and   msi.inventory_item_id = assy_id_dummy;
Line: 3130

       update bom_sub_comps_interface set
                    process_flag = 3
        where transaction_id = c1rec.TI;
Line: 3153

       update bom_sub_comps_interface set
                    process_flag = 3
        where transaction_id = c1rec.TI;
Line: 3166

      select count(*)
        into dummy
        from bom_sub_comps_interface a
        where transaction_id = c1rec.TI
        and   process_flag <> 3 and process_flag <> 7
        and   not exists (select 'items exist'
            from mtl_system_items b
            where b.organization_id = org_id_dummy
            and   b.inventory_item_id = a.substitute_component_id);
Line: 3190

            update bom_sub_comps_interface set
                process_flag = 3
            where transaction_id = c1rec.TI;
Line: 3219

            update bom_sub_comps_interface set
                    process_flag = 3
            where transaction_id = c1rec.TI;
Line: 3232

        select count(*)
        into dummy
        from bom_sub_comps_interface
        where transaction_id = c1rec.TI
        and   (SUBSTITUTE_COMPONENT_ID = assy_id_dummy
                or
               SUBSTITUTE_COMPONENT_ID = comp_id_dummy)
        and process_flag <> 3 and process_flag <> 7;
Line: 3255

            update bom_sub_comps_interface set
                process_flag = 3
            where transaction_id = c1rec.TI;
Line: 3268

      select count(*)
        into dummy
        from bom_sub_comps_interface bsc
       where bsc.transaction_id = c1rec.TI
         and not exists (select 'x'
                           from mtl_system_items msi
                          where organization_id = org_id_dummy
                          and inventory_item_id = bsc.substitute_component_id
                          and bom_enabled_flag = 'Y'
                          and bom_item_type = 4
                          and ((assy_type_dummy = 2)
                                or
                                (assy_type_dummy = 1
                                 and eng_item_flag = 'N')));
Line: 3296

            update bom_sub_comps_interface set
                process_flag = 3
            where transaction_id = c1rec.TI;
Line: 3309

	select count(*)
	into dummy
	from bom_sub_comps_interface
	where transaction_id = c1rec.TI
        and   process_flag <> 3 and process_flag <> 7
	and   substitute_item_quantity = 0;
Line: 3329

            update bom_sub_comps_interface set
		process_flag = 3
	    where transaction_id = c1rec.TI;
Line: 3339

        update bom_sub_comps_interface
           set process_flag = 4
         where transaction_id = c1rec.TI;
Line: 3394

        select 1
        into dummy
        from bom_substitute_components a, bom_sub_comps_interface b
        where b.transaction_id = trans_id
        and   a.component_sequence_id = b.component_sequence_id
        and   a.SUBSTITUTE_COMPONENT_ID =
                b.SUBSTITUTE_COMPONENT_ID
        and rownum = 1;
Line: 3416

    select count(*)
        into dummy
        from bom_sub_comps_interface a
        where transaction_id = trans_id
        and   exists (select 'same substitue'
                from bom_sub_comps_interface b
                where b.transaction_id = trans_id
                and   b.rowid <> a.rowid
                and   b.SUBSTITUTE_COMPONENT_ID =
                        a.SUBSTITUTE_COMPONENT_ID
                and   b.process_flag <> 3
                and   b.process_flag <> 7)
        and   process_flag <> 3
        and   process_flag <> 7;
Line: 3481

        select inventory_item_id AII, organization_id OI,
               revision R, transaction_id TI
        from mtl_item_revisions_interface
        where process_flag = 2
          and rownum < 500;
Line: 3488

        select inventory_item_id AII, organization_id OI
        from mtl_item_revisions_interface
        where process_flag = 99
          and rownum < 500
        group by organization_id, inventory_item_id;
Line: 3495

        select 'x'
          from mtl_item_revisions_interface
         where process_flag = 99
        group by organization_id, inventory_item_id;
Line: 3531

         update mtl_item_revisions_interface set
             process_flag = 3
          where transaction_id = c0rec.TI;
Line: 3545

           select organization_id
             into dummy_id
            from mtl_parameters
           where organization_id = c0rec.OI;
Line: 3563

               update mtl_item_revisions_interface set
                       process_flag = 3
               where transaction_id = c0rec.TI;
Line: 3591

            update mtl_item_revisions_interface set
                    process_flag = 3
            where transaction_id = c0rec.TI;
Line: 3606

     select count(*)
       into dummy_bill
      from bom_bill_of_materials
     where organization_id = c0rec.OI
       and assembly_item_id = c0rec.AII;
Line: 3613

            select count(*)
              into dummy_bill
              from bom_bill_of_mtls_interface
             where process_flag = 4
               and organization_id = c0rec.OI
               and assembly_item_id = c0rec.AII;
Line: 3633

               update mtl_item_revisions_interface set
                    process_flag = 3
               where transaction_id = c0rec.TI;
Line: 3644

     update mtl_item_revisions_interface set
            process_flag = 99
      where transaction_id = c0rec.TI;
Line: 3736

        select revision R, effectivity_date ED,
                transaction_id TI
        from mtl_item_revisions_interface
        where organization_id = org_id
        and   inventory_item_id = assy_id
        and   process_flag = 99;
Line: 3753

        select count(*)
          into err_cnt
          from mtl_item_revisions_interface a
         where transaction_id <> c1rec.TI
           and   inventory_item_id = assy_id
           and   organization_id = org_id
           and   process_flag = 4
           and ( (revision = c1rec.R)
                or
                  (effectivity_date > c1rec.ED
                   and revision < c1rec.R)
                or
                  (effectivity_date < c1rec.ED
                   and revision > c1rec.R)
                );
Line: 3774

        select count(*)
            into err_cnt
            from mtl_item_revisions
            where inventory_item_id = assy_id
            and   organization_id = org_id
            and ( (revision = c1rec.R)
                or
                  (effectivity_date > c1rec.ED
                   and revision < c1rec.R)
                or
                  (effectivity_date < c1rec.ED
                   and revision > c1rec.R)
                );
Line: 3793

        update mtl_item_revisions_interface set
            process_flag = 4
        where transaction_id = c1rec.TI;
Line: 3811

        update mtl_item_revisions_interface set
            process_flag = 3
        where transaction_id = c1rec.TI;