DBA Data[Home] [Help]

APPS.ICX_POR_EXT_ITEM SQL Statements

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

Line: 14

DELETE_PRICE            PLS_INTEGER := 6; -- Delete price row
Line: 33

  last_update_date              DATE,
  org_id                        NUMBER,
  supplier_id                   NUMBER,
  supplier                      icx_cat_items_b.supplier%TYPE,
  supplier_site_code            icx_cat_item_prices.supplier_site_code%TYPE,
  supplier_part_num             icx_cat_items_b.supplier_part_num%TYPE,
  internal_item_id              NUMBER,
  internal_item_num             icx_cat_items_b.internal_item_num%TYPE,
  inventory_organization_id     NUMBER,
  item_source_type              icx_cat_items_tlp.item_source_type%TYPE,
  item_search_type              icx_cat_items_tlp.search_type%TYPE,
  mtl_category_id               NUMBER,
  category_key                  icx_cat_categories_tl.key%TYPE,
  description                   icx_cat_items_tlp.description%TYPE,
  picture                       icx_cat_items_tlp.picture%TYPE,
  picture_url                   icx_cat_items_tlp.picture_url%TYPE,
  price_type                    icx_cat_item_prices.price_type%TYPE,
  asl_id                        NUMBER,
  supplier_site_id              NUMBER,
  contract_id                   NUMBER,
  contract_line_id              NUMBER,
  template_id                   icx_cat_item_prices.template_id%TYPE,
  template_line_id              NUMBER,
  price_search_type             icx_cat_item_prices.search_type%TYPE,
  --FPJ FPSL Extractor Changes
  --unit_price column will hold amount for items with Fixed Price Services line_type
  --For all other items it will hold price
  unit_price                    NUMBER,
  --FPJ FPSL Extractor Changes
  value_basis                   icx_cat_item_prices.value_basis%TYPE,
  purchase_basis                icx_cat_item_prices.purchase_basis%TYPE,
  allow_price_override_flag     icx_cat_item_prices.allow_price_override_flag%TYPE,
  not_to_exceed_price           NUMBER,
  -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
  suggested_quantity            NUMBER,
  -- FPJ Bug# 3110297 jingyu    Add negotiated flag
  negotiated_by_preparer_flag   icx_cat_item_prices.negotiated_by_preparer_flag%TYPE,
  currency                      icx_cat_item_prices.currency%TYPE,
  unit_of_measure               icx_cat_item_prices.unit_of_measure%TYPE,
  functional_price              NUMBER,
  contract_num                  icx_cat_item_prices.contract_num%TYPE,
  contract_line_num             NUMBER,
  manufacturer                  ICX_CAT_ITEMS_TLP.manufacturer%TYPE,
  manufacturer_part_num         ICX_CAT_ITEMS_TLP.manufacturer_part_num%TYPE,
  rate_type                     ICX_CAT_ITEM_PRICES.rate_type%TYPE,
  rate_date                     DATE,
  rate                          NUMBER,
  supplier_number               ICX_CAT_ITEM_PRICES.supplier_number%TYPE,
  supplier_contact_id           NUMBER,
  item_revision                 ICX_CAT_ITEM_PRICES.item_revision%TYPE,
  line_type_id                  NUMBER,
  buyer_id                      NUMBER,
  global_agreement_flag         VARCHAR2(1),
  status                        NUMBER,
  primary_category_id           NUMBER,
  primary_category_name         icx_cat_categories_tl.category_name%TYPE,
  template_category_id          NUMBER,
  price_rt_item_id              NUMBER,
  price_internal_item_id        NUMBER,
  price_supplier_id             NUMBER,
  price_supplier_part_num       icx_cat_items_b.supplier_part_num%TYPE,
  price_contract_line_id        NUMBER,
  price_mtl_category_id         NUMBER,
  match_primary_category_id     NUMBER,
  rt_item_id                    NUMBER,
  local_rt_item_id              NUMBER,
  match_template_flag           VARCHAR2(1),
  active_flag                   VARCHAR2(1),
  price_rowid                   VARCHAR2(30) );
Line: 176

gUPLastUpdateDates      DBMS_SQL.DATE_TABLE;
Line: 237

gIPLastUpdateDates      DBMS_SQL.DATE_TABLE;
Line: 251

gUBExtractorUpdatedFlags DBMS_SQL.VARCHAR2_TABLE;
Line: 409

  IF (pMode IN ('ALL', 'UPDATE_PRICES')) THEN
    -- Update ICX_CAT_ITEM_PRICES
    gUPRtItemIds.DELETE;
Line: 412

    gUPPriceTypes.DELETE;
Line: 413

    gUPAslIds.DELETE;
Line: 414

    gUPSupplierSiteIds.DELETE;
Line: 415

    gUPContractIds.DELETE;
Line: 416

    gUPContractLineIds.DELETE;
Line: 417

    gUPTemplateIds.DELETE;
Line: 418

    gUPTemplateLineIds.DELETE;
Line: 419

    gUPInventoryItemIds.DELETE;
Line: 420

    gUPMtlCategoryIds.DELETE;
Line: 421

    gUPOrgIds.DELETE;
Line: 422

    gUPSearchTypes.DELETE;
Line: 423

    gUPUnitPrices.DELETE;
Line: 425

    gUPValueBasis.DELETE;
Line: 426

    gUPPurchaseBasis.DELETE;
Line: 427

    gUPAllowPriceOverrideFlag.DELETE;
Line: 428

    gUPNotToExceedPrice.DELETE;
Line: 430

    gUPSuggestedQuantities.DELETE;
Line: 432

    gUPNegotiatedFlag.DELETE;
Line: 433

    gUPCurrencys.DELETE;
Line: 434

    gUPUnitOfMeasures.DELETE;
Line: 435

    gUPFunctionalPrices.DELETE;
Line: 436

    gUPSupplierSiteCodes.DELETE;
Line: 437

    gUPContractNums.DELETE;
Line: 438

    gUPContractLineNums.DELETE;
Line: 439

    gUpRateTypes.DELETE;
Line: 440

    gUpRateDates.DELETE;
Line: 441

    gUpRates.DELETE;
Line: 442

    gUpSupplierNumbers.DELETE;
Line: 443

    gUpSupplierContactIds.DELETE;
Line: 444

    gUpItemRevisions.DELETE;
Line: 445

    gUpLineTypeIds.DELETE;
Line: 446

    gUpBuyerIds.DELETE;
Line: 447

    gUPPriceRowIds.DELETE;
Line: 448

    gUPActiveFlags.DELETE;
Line: 449

    gUPLastUpdateDates.DELETE;
Line: 453

  IF (pMode IN ('ALL', 'UPDATE_PRICES_G')) THEN
    -- Update ICX_CAT_ITEM_PRICES for global agreements
    gUPGRtItemIds.DELETE;
Line: 456

    gUPGContractIds.DELETE;
Line: 457

    gUPGContractLineIds.DELETE;
Line: 458

    gUPGInventoryItemIds.DELETE;
Line: 459

    gUPGMtlCategoryIds.DELETE;
Line: 460

    gUPGSearchTypes.DELETE;
Line: 461

    gUPGUnitPrices.DELETE;
Line: 463

    gUPGValueBasis.DELETE;
Line: 464

    gUPGPurchaseBasis.DELETE;
Line: 465

    gUPGAllowPriceOverrideFlag.DELETE;
Line: 466

    gUPGNotToExceedPrice.DELETE;
Line: 468

    gUPGNegotiatedFlag.DELETE;
Line: 469

    gUPGLineTypeIds.DELETE;
Line: 470

    gUPGCurrencys.DELETE;
Line: 471

    gUPGUnitOfMeasures.DELETE;
Line: 472

    gUPGFunctionalPrices.DELETE;
Line: 475

  IF (pMode IN ('ALL', 'INSERT_PRICES')) THEN
    -- Insert ICX_CAT_ITEM_PRICES
    gIPRtItemIds.DELETE;
Line: 478

    gIPPriceTypes.DELETE;
Line: 479

    gIPAslIds.DELETE;
Line: 480

    gIPSupplierSiteIds.DELETE;
Line: 481

    gIPContractIds.DELETE;
Line: 482

    gIPContractLineIds.DELETE;
Line: 483

    gIPTemplateIds.DELETE;
Line: 484

    gIPTemplateLineIds.DELETE;
Line: 485

    gIPInventoryItemIds.DELETE;
Line: 486

    gIPMtlCategoryIds.DELETE;
Line: 487

    gIPOrgIds.DELETE;
Line: 488

    gIPSearchTypes.DELETE;
Line: 489

    gIPUnitPrices.DELETE;
Line: 491

    gIPValueBasis.DELETE;
Line: 492

    gIPPurchaseBasis.DELETE;
Line: 493

    gIPAllowPriceOverrideFlag.DELETE;
Line: 494

    gIPNotToExceedPrice.DELETE;
Line: 496

    gIPSuggestedQuantities.DELETE;
Line: 498

    gIPNegotiatedFlag.DELETE;
Line: 499

    gIPCurrencys.DELETE;
Line: 500

    gIPUnitOfMeasures.DELETE;
Line: 501

    gIPFunctionalPrices.DELETE;
Line: 502

    gIPSupplierSiteCodes.DELETE;
Line: 503

    gIPContractNums.DELETE;
Line: 504

    gIPContractLineNums.DELETE;
Line: 505

    gIpRateTypes.DELETE;
Line: 506

    gIpRateDates.DELETE;
Line: 507

    gIpRates.DELETE;
Line: 508

    gIpSupplierNumbers.DELETE;
Line: 509

    gIpSupplierContactIds.DELETE;
Line: 510

    gIpItemRevisions.DELETE;
Line: 511

    gIpLineTypeIds.DELETE;
Line: 512

    gIpBuyerIds.DELETE;
Line: 513

    gIPActiveFlags.DELETE;
Line: 514

    gIPLastUpdateDates.DELETE;
Line: 517

  IF (pMode IN ('ALL', 'INSERT_ITEMS_B')) THEN
    -- Insert ICX_CAT_ITEMS_B
    gIBRtItemIds.DELETE;
Line: 520

    gIBOrgIds.DELETE;
Line: 521

    gIBSupplierIds.DELETE;
Line: 522

    gIBSuppliers.DELETE;
Line: 523

    gIBSupplierPartNums.DELETE;
Line: 524

    gIBInternalItemIds.DELETE;
Line: 525

    gIBInternalItemNums.DELETE;
Line: 528

  IF (pMode IN ('ALL', 'UPDATE_ITEMS_B')) THEN
    -- Update ICX_CAT_ITEMS_B
    gUBRtItemIds.DELETE;
Line: 531

    gUBInternalItemNums.DELETE;
Line: 532

    gUBExtractorUpdatedFlags.DELETE;
Line: 533

    gUBJobNumbers.DELETE;
Line: 536

  IF (pMode IN ('ALL', 'INSERT_ITEMS_TLP')) THEN
    -- Insert ICX_CAT_ITEMS_TLP
    gITRtItemIds.DELETE;
Line: 539

    gITLanguages.DELETE;
Line: 540

    gITOrgIds.DELETE;
Line: 541

    gITSupplierIds.DELETE;
Line: 542

    gITItemSourceTypes.DELETE;
Line: 543

    gITSearchTypes.DELETE;
Line: 544

    gITPrimaryCategoryIds.DELETE;
Line: 545

    gITPrimaryCategoryNames.DELETE;
Line: 546

    gITInternalItemIds.DELETE;
Line: 547

    gITInternalItemNums.DELETE;
Line: 548

    gITSuppliers.DELETE;
Line: 549

    gITSupplierPartNums.DELETE;
Line: 550

    gITDescriptions.DELETE;
Line: 551

    gITPictures.DELETE;
Line: 552

    gITPictureURLs.DELETE;
Line: 553

    gITManufacturers.DELETE;
Line: 554

    gITManufacturerPartNums.DELETE;
Line: 557

  IF (pMode IN ('ALL', 'UPDATE_ITEMS_TLP')) THEN
    -- Update ICX_CAT_ITEMS_TLP
    gUTRtItemIds.DELETE;
Line: 560

    gUTLanguages.DELETE;
Line: 561

    gUTItemSourceTypes.DELETE;
Line: 562

    gUTSearchTypes.DELETE;
Line: 563

    gUTPrimaryCategoryIds.DELETE;
Line: 564

    gUTPrimaryCategoryNames.DELETE;
Line: 565

    gUTInternalItemNums.DELETE;
Line: 566

    gUTDescriptions.DELETE;
Line: 567

    gUTPictures.DELETE;
Line: 568

    gUTPictureURLs.DELETE;
Line: 569

    gUTManufacturers.DELETE;
Line: 570

    gUTManufacturerPartNums.DELETE;
Line: 573

  IF (pMode IN ('ALL', 'INSERT_CATEGORY_ITEMS')) THEN
    -- Insert ICX_CAT_CATEGORY_ITEMS
    gICRtItemIds.DELETE;
Line: 576

    gICRtCategoryIds.DELETE;
Line: 579

  IF (pMode IN ('ALL', 'UPDATE_CATEGORY_ITEMS')) THEN
    -- Update ICX_CAT_CATEGORY_ITEMS
    gUCRtItemIds.DELETE;
Line: 582

    gUCRtCategoryIds.DELETE;
Line: 583

    gUCOldRtCategoryIds.DELETE;
Line: 586

  IF (pMode IN ('ALL', 'INSERT_EXT_ITEMS')) THEN
    -- Insert ICX_CAT_EXT_ITEMS_TLP
    gIERtItemIds.DELETE;
Line: 589

    gIELanguages.DELETE;
Line: 590

    gIEOrgIds.DELETE;
Line: 591

    gIERtCategoryIds.DELETE;
Line: 594

  IF (pMode IN ('ALL', 'UPDATE_EXT_ITEMS')) THEN
    -- Update ICX_CAT_EXT_ITEMS_TLP
    gUERtItemIds.DELETE;
Line: 597

    gUELanguages.DELETE;
Line: 598

    gUERtCategoryIds.DELETE;
Line: 599

    gUEOldRtCategoryIds.DELETE;
Line: 602

  IF (pMode IN ('ALL', 'DELETE_ITEM_PRICE')) THEN
    -- Delete Item Price
    gDPRowIds.DELETE;
Line: 605

    gDPTemplateCategoryIds.DELETE;
Line: 606

    gDPRtItemIds.DELETE;
Line: 607

    gDPInventoryItemIds.DELETE;
Line: 608

    gDPOrgIds.DELETE;
Line: 609

    gDPLocalRtItemIds.DELETE;
Line: 612

  IF (pMode IN ('ALL', 'DELETE_ITEM_PRICE_GA')) THEN
    -- Delete Item Price for global agreement
    gDPGContractIds.DELETE;
Line: 615

    gDPGContractLineIds.DELETE;
Line: 618

  IF (pMode IN ('ALL', 'DELETE_PURCHASING_ITEM')) THEN
    -- Delete Purchasing Item
    gDIPurchasingItemIds.DELETE;
Line: 621

    gDIPurchasingOrgIds.DELETE;
Line: 624

  IF (pMode IN ('ALL', 'DELETE_NULL_PRICE_ITEM')) THEN
    -- Delete Null Price Item
    gDINullPriceItemIds.DELETE;
Line: 627

    gDINullPriceOrgIds.DELETE;
Line: 630

  IF (pMode IN ('ALL', 'DELETE_INTERNAL_ITEM')) THEN
    -- Delete Internal Item
    gDIInternalItemIds.DELETE;
Line: 633

    gDIInternalOrgIds.DELETE;
Line: 638

    gCIRtItemIds.DELETE;
Line: 641

  IF (pMode IN ('ALL', 'TOUCH_UPDATED_GA')) THEN
    -- Insert temporary table to update global agreement
    gUGAContractIds.DELETE;
Line: 644

    gUGAContractLineIds.DELETE;
Line: 649

    gTARtItemIds.DELETE;
Line: 654

    gTAInvItemIds.DELETE;
Line: 655

    gTAInvOrgIds.DELETE;
Line: 658

  IF (pMode IN ('ALL', 'DELETE_ITEM_NOPRICE')) THEN
    -- Delete Items without price
    gDIRtItemIds.DELETE;
Line: 665

    gSAPriceTypes.DELETE;
Line: 666

    gSARtItemIds.DELETE;
Line: 667

    gSARowIds.DELETE;
Line: 668

    gSAActiveFlags.DELETE;
Line: 671

  IF (pMode IN ('ALL', 'UPDATE_PRICES_GA')) THEN
    -- Update ICX_CAT_ITEM_PRICES for local global agreements
    gUPGASupplierSiteIds.DELETE;
Line: 674

    gUPGAContractIds.DELETE;
Line: 675

    gUPGAContractLineIds.DELETE;
Line: 676

    gUPGAFunctionalPrices.DELETE;
Line: 677

    gUPGASupplierSiteCodes.DELETE;
Line: 679

    gUPGALineTypeIds.DELETE;
Line: 680

    gUPGARateTypes.DELETE;
Line: 681

    gUPGARateDates.DELETE;
Line: 682

    gUPGARates.DELETE;
Line: 684

    gUPGAOrgIds.DELETE;
Line: 687

  IF (pMode IN ('ALL', 'INSERT_PRICES_GA')) THEN
    -- Insert ICX_CAT_ITEM_PRICES for local global agreements
    gIPGARtItemIds.DELETE;
Line: 690

    gIPGALocalRtItemIds.DELETE;
Line: 691

    gIPGASupplierSiteIds.DELETE;
Line: 692

    gIPGAContractIds.DELETE;
Line: 693

    gIPGAContractLineIds.DELETE;
Line: 694

    gIPGAInventoryItemIds.DELETE;
Line: 695

    gIPGAMtlCategoryIds.DELETE;
Line: 696

    gIPGAOrgIds.DELETE;
Line: 697

    gIPGAUnitPrices.DELETE;
Line: 699

    gIPGAValueBasis.DELETE;
Line: 700

    gIPGAPurchaseBasis.DELETE;
Line: 701

    gIPGAAllowPriceOverrideFlag.DELETE;
Line: 702

    gIPGANotToExceedPrice.DELETE;
Line: 704

    gIPGANegotiatedFlag.DELETE;
Line: 705

    gIPGACurrencys.DELETE;
Line: 706

    gIPGAUnitOfMeasures.DELETE;
Line: 707

    gIPGAFunctionalPrices.DELETE;
Line: 708

    gIPGASupplierSiteCodes.DELETE;
Line: 709

    gIPGAContractNums.DELETE;
Line: 710

    gIPGAContractLineNums.DELETE;
Line: 712

    gIPGALineTypeIds.DELETE;
Line: 713

    gIPGARateTypes.DELETE;
Line: 714

    gIPGARateDates.DELETE;
Line: 715

    gIPGARates.DELETE;
Line: 720

    gSLRRowIds.DELETE;
Line: 721

    gSLRALocalRtItemIds.DELETE;
Line: 732

  IF (pMode = 'UPDATE_PRICES') THEN
    -- Update ICX_CAT_ITEM_PRICES
    xShot := xShot || ' gUPRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUPRtItemIds, pIndex) || ', ';
Line: 805

    xShot := xShot || ' gUPLastUpdateDates: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUPLastUpdateDates, pIndex);
Line: 807

  ELSIF (pMode = 'UPDATE_PRICES_G') THEN
    -- Update ICX_CAT_ITEM_PRICES for global agreements
    xShot := xShot || ' gUPGRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUPGRtItemIds, pIndex) || ', ';
Line: 843

  ELSIF (pMode = 'INSERT_PRICES') THEN
    -- Insert ICX_CAT_ITEM_PRICES
    xShot := xShot || ' gIPRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gIPRtItemIds, pIndex) || ', ';
Line: 916

    xShot := xShot || ' gIPLastUpdateDates: ' ||
      ICX_POR_EXT_UTL.getTableElement(gIPLastUpdateDates, pIndex);
Line: 918

  ELSIF (pMode = 'INSERT_ITEMS_B') THEN
    -- Insert ICX_CAT_ITEMS_B
    xShot := xShot || ' gIBRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gIBRtItemIds, pIndex) || ', ';
Line: 934

  ELSIF (pMode = 'UPDATE_ITEMS_B') THEN
    -- Update ICX_CAT_ITEMS_B
    xShot := xShot || ' gUBRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUBRtItemIds, pIndex) || ', ';
Line: 940

    xShot := xShot || ' gUBExtractorUpdatedFlags: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUBExtractorUpdatedFlags, pIndex) || ', ';
Line: 944

  ELSIF (pMode = 'INSERT_ITEMS_TLP') THEN
    -- Insert ICX_CAT_ITEMS_TLP
    xShot := xShot || ' gITRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gITRtItemIds, pIndex) || ', ';
Line: 980

  ELSIF (pMode = 'UPDATE_ITEMS_TLP') THEN
    -- Update ICX_CAT_ITEMS_TLP
    xShot := xShot || ' gUTRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUTRtItemIds, pIndex) || ', ';
Line: 1006

  ELSIF (pMode = 'INSERT_CATEGORY_ITEMS') THEN
    -- Insert ICX_CAT_CATEGORY_ITEMS
    xShot := xShot || ' gICRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gICRtItemIds, pIndex) || ', ';
Line: 1012

  ELSIF (pMode = 'UPDATE_CATEGORY_ITEMS') THEN
    -- Update ICX_CAT_CATEGORY_ITEMS
    xShot := xShot || ' gUCRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUCRtItemIds, pIndex) || ', ';
Line: 1020

  ELSIF (pMode = 'INSERT_EXT_ITEMS') THEN
    -- Insert ICX_CAT_EXT_ITEMS_TLP
    xShot := xShot || ' gIERtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gIERtItemIds, pIndex) || ', ';
Line: 1028

  ELSIF (pMode = 'UPDATE_EXT_ITEMS') THEN
    -- Update ICX_CAT_EXT_ITEMS_TLP
    xShot := xShot || ' gUERtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUERtItemIds, pIndex) || ', ';
Line: 1036

  ELSIF (pMode = 'DELETE_ITEM_PRICE') THEN
    -- Delete Item Price
    xShot := xShot || ' gDPRowIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gDPRowIds, pIndex) || ', ';
Line: 1050

  ELSIF (pMode = 'DELETE_ITEM_PRICE_GA') THEN
    -- Delete Item Price fro global agreement
    xShot := xShot || ' gDPGContractIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gDPGContractIds, pIndex)||', ';
Line: 1056

  ELSIF (pMode = 'DELETE_PURCHASING_ITEM') THEN
    -- Delete Item
    xShot := xShot || ' gDIPurchasingItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gDIPurchasingItemIds, pIndex) || ', ';
Line: 1062

  ELSIF (pMode = 'DELETE_NULL_PRICE_ITEM') THEN
    xShot := xShot || ' gDINullPriceItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gDINullPriceItemIds, pIndex) || ', ';
Line: 1067

  ELSIF (pMode = 'DELETE_INTERNAL_ITEM') THEN
    xShot := xShot || ' gDIInternalItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gDIInternalItemIds, pIndex) || ', ';
Line: 1076

  ELSIF (pMode = 'TOUCH_UPDATED_GA') THEN
    -- Insert temporary table to update global agreement
    xShot := xShot || ' gUGAContractIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUGAContractIds, pIndex)||', ';
Line: 1092

  ELSIF (pMode = 'DELETE_ITEM_NOPRICE') THEN
    -- Delete Items without price
    xShot := xShot || ' gDIRtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gDIRtItemIds, pIndex);
Line: 1096

  ELSIF (pMode = 'UPDATE_PRICES_GA') THEN
    -- Update ICX_CAT_ITEM_PRICES for local global agreements
    xShot := xShot || ' gUPGASupplierSiteIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gUPGASupplierSiteIds, pIndex) || ', ';
Line: 1110

  ELSIF (pMode = 'INSERT_PRICES_GA') THEN
    -- Insert ICX_CAT_ITEM_PRICES for local global agreements
    xShot := xShot || ' gIPGARtItemIds: ' ||
      ICX_POR_EXT_UTL.getTableElement(gIPGARtItemIds, pIndex) || ', ';
Line: 1246

  ELSIF pItemStatus = DELETE_PRICE THEN
    xItemStatusStr := 'DELETE_PRICE';
Line: 1279

    ', last_update_date: ' || gCurrentPrice.last_update_date ||
    ', org_id: ' || gCurrentPrice.org_id ||
    ', supplier_id: ' || gCurrentPrice.supplier_id ||
    ', supplier: ' || gCurrentPrice.supplier ||
    ', supplier_site_code: ' || gCurrentPrice.supplier_site_code ||
    ', supplier_part_num: ' || gCurrentPrice.supplier_part_num ||
    ', internal_item_id: ' || gCurrentPrice.internal_item_id ||
    ', internal_item_num: ' || gCurrentPrice.internal_item_num ||
    ', inventory_organization_id: ' || gCurrentPrice.inventory_organization_id ||
    ', item_source_type: ' || gCurrentPrice.item_source_type ||
    ', item_search_type: ' || gCurrentPrice.item_search_type ||
    ', mtl_category_id: ' || gCurrentPrice.mtl_category_id ||
    ', category_key: ' || gCurrentPrice.category_key ||
    ', description: ' || gCurrentPrice.description ||
    ', picture: ' || gCurrentPrice.picture ||
    ', picture_url: ' || gCurrentPrice.picture_url ||
    ', price_type: ' || gCurrentPrice.price_type ||
    ', asl_id: ' || gCurrentPrice.asl_id ||
    ', supplier_site_id: ' || gCurrentPrice.supplier_site_id ||
    ', contract_id: ' || gCurrentPrice.contract_id ||
    ', contract_line_id: ' || gCurrentPrice.contract_line_id ||
    ', template_id: ' || gCurrentPrice.template_id ||
    ', template_line_id: ' || gCurrentPrice.template_line_id ||
    ', price_search_type: ' || gCurrentPrice.price_search_type ||
    ', unit_price: ' || gCurrentPrice.unit_price ||
    --FPJ FPSL Extractor Changes
    ', value_basis: ' || gCurrentPrice.value_basis ||
    ', purchase_basis: ' || gCurrentPrice.purchase_basis ||
    ', allow_price_override_flag: ' || gCurrentPrice.allow_price_override_flag ||
    ', not_to_exceed_price: ' || gCurrentPrice.not_to_exceed_price ||
    ', line_type_id: ' || gCurrentPrice.line_type_id ||
    -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
    ', suggested_quantity: ' || gCurrentPrice.suggested_quantity ||
    -- FPJ Bug# 3110297 jingyu  Add negotiated flag
    ', negotiated_by_preparer_flag: ' || gCurrentPrice.negotiated_by_preparer_flag ||
    ', currency: ' || gCurrentPrice.currency ||
    ', unit_of_measure: ' || gCurrentPrice.unit_of_measure ||
    ', functional_price: ' || gCurrentPrice.functional_price ||
    ', contract_num: ' || gCurrentPrice.contract_num ||
    ', contract_line_num: ' || gCurrentPrice.contract_line_num ||
    ', global_agreement_flag: ' || gCurrentPrice.global_agreement_flag ||
    ', status: ' || ICX_POR_EXT_DIAG.getStatusString(gCurrentPrice.status) ||
    ', primary_category_id: ' || gCurrentPrice.primary_category_id ||
    ', primary_category_name: ' || gCurrentPrice.primary_category_name ||
    ', template_category_id: ' || gCurrentPrice.template_category_id ||
    ', price_rt_item_id: ' || gCurrentPrice.price_rt_item_id ||
    ', price_internal_item_id: ' || gCurrentPrice.price_internal_item_id ||
    ', price_supplier_id: ' || gCurrentPrice.price_supplier_id ||
    ', price_supplier_part_num: ' || gCurrentPrice.price_supplier_part_num ||
    ', price_contract_line_id: ' || gCurrentPrice.price_contract_line_id ||
    ', price_mtl_category_id: ' || gCurrentPrice.price_mtl_category_id ||
    ', match_primary_category_id: '||gCurrentPrice.match_primary_category_id||
    ', rt_item_id: ' || gCurrentPrice.rt_item_id ||
    ', local_rt_item_id: ' || gCurrentPrice.local_rt_item_id ||
    ', match_template_flag: ' || gCurrentPrice.match_template_flag ||
    ', active_flag: ' || gCurrentPrice.active_flag ||
    ', price_rowid: ' || gCurrentPrice.price_rowid || ']';
Line: 1367

    SELECT 'N'
    INTO   xActiveFlag
    FROM   icx_cat_item_prices p
    WHERE  p.rowid = p_price_row_id
    AND    EXISTS (SELECT 'documents'
                   FROM   icx_cat_item_prices p2
                   WHERE  p.org_id = p2.org_id
                   AND    p.inventory_item_id = p2.inventory_item_id
                   AND    p2.price_type IN ('TEMPLATE', 'BLANKET',
                                            'QUOTATION', 'GLOBAL_AGREEMENT',
                                            'ASL', 'BULKLOAD', 'CONTRACT'));
Line: 1379

    SELECT 'N'
    INTO   xActiveFlag
    FROM   icx_cat_item_prices p
    WHERE  p.rowid = p_price_row_id
    AND    (EXISTS (SELECT 'documents'
                    FROM   icx_cat_item_prices p2
                    WHERE  p.rt_item_id = p2.rt_item_id
                    AND    p2.price_type IN ('TEMPLATE', 'BLANKET',
                                             'QUOTATION', 'BULKLOAD',
                                             'CONTRACT')) OR
            EXISTS (SELECT 'global agreements'
                    FROM   icx_cat_item_prices p2
                    WHERE  p.rt_item_id = p2.local_rt_item_id
                    AND    p2.price_type = 'GLOBAL_AGREEMENT'));
Line: 1394

    SELECT 'N'
    INTO   xActiveFlag
    FROM   icx_cat_item_prices p
    WHERE  p.rowid = p_price_row_id
    AND    (EXISTS (SELECT 'documents'
                    FROM   icx_cat_item_prices p2
                    WHERE  p.rt_item_id = p2.rt_item_id
                    AND    p2.price_type IN ('TEMPLATE', 'BLANKET',
                                             'QUOTATION')) OR
            EXISTS (SELECT 'global agreements'
                    FROM   icx_cat_item_prices p2
                    WHERE  p.rt_item_id = p2.local_rt_item_id
                    AND    p2.price_type = 'GLOBAL_AGREEMENT'));
Line: 1408

    SELECT 'N'
    INTO   xActiveFlag
    FROM   icx_cat_item_prices p
    WHERE  p.rowid = p_price_row_id
    AND    ((p.contract_line_id <> -2 AND
             EXISTS (SELECT 'recently updated templates with same contract'
                     FROM   icx_cat_item_prices p2
                     WHERE  p.rt_item_id = p2.rt_item_id
                     AND    p.contract_line_id = p2.contract_line_id
                     AND    p.supplier_site_id = p2.supplier_site_id
                     AND    p2.price_type = 'TEMPLATE'
                     AND    p2.rowid <> p.rowid
                     AND    ((p2.last_update_date > p.last_update_date) OR
                             (p2.last_update_date = p.last_update_date AND
                              EXISTS (SELECT 'exists'
                                      FROM  po_reqexpress_lines_all r1,
                                            po_reqexpress_lines_all r2
                                      WHERE r2.express_name = p2.template_id
                                        AND r2.sequence_num = p2. template_line_id
                                        AND nvl(r2.org_id, -2) = p2.org_id
                                        AND r1.express_name = p.template_id
                                        AND r1.sequence_num = p. template_line_id
                                        AND nvl(r1.org_id, -2) = p.org_id
                                        AND r2.last_update_date > r1.last_update_date))))) OR
            (p.contract_line_id = -2 AND
             (EXISTS (SELECT 'contracts'
                      FROM   icx_cat_item_prices p2
                      WHERE  p.rt_item_id = p2.rt_item_id
                      AND    p2.contract_line_id <> -2) OR
              EXISTS (SELECT 'recently updated templates'
                      FROM   icx_cat_item_prices p2
                      WHERE  p.rt_item_id = p2.rt_item_id
                      AND    p2.contract_line_id = -2
                      AND    p.supplier_site_id = p2.supplier_site_id
                      AND    p2.price_type = 'TEMPLATE'
                      AND    p2.rowid <> p.rowid
                      AND    ((p2.last_update_date > p.last_update_date) OR
                              (p2.last_update_date = p.last_update_date AND
                               EXISTS (SELECT 'exists'
                                       FROM  po_reqexpress_lines_all r1,
                                             po_reqexpress_lines_all r2
                                       WHERE r2.express_name = p2.template_id
                                         AND r2.sequence_num = p2. template_line_id
                                         AND nvl(r2.org_id, -2) = p2.org_id
                                         AND r1.express_name = p.template_id
                                         AND r1.sequence_num = p. template_line_id
                                         AND nvl(r1.org_id, -2) = p.org_id
                                         AND r2.last_update_date > r1.last_update_date)))))) OR
            EXISTS (SELECT 'global agreements'
                    FROM   icx_cat_item_prices p2
                    WHERE  p.rt_item_id = p2.local_rt_item_id
                    AND    p2.price_type = 'GLOBAL_AGREEMENT'));
Line: 1461

    SELECT 'N'
    INTO   xActiveFlag
    FROM   icx_cat_item_prices p
    WHERE  p.rowid = p_price_row_id
    AND    EXISTS (SELECT 'template with same contract'
                   FROM   icx_cat_item_prices p2
                   WHERE  p.rt_item_id = p2.rt_item_id
                   AND    p.contract_line_id = p2.contract_line_id
                   AND    p2.price_type = 'TEMPLATE');
Line: 1471

    SELECT 'N'
    INTO   xActiveFlag
    FROM   icx_cat_item_prices p
    WHERE  p.rowid = p_price_row_id
    AND    EXISTS (SELECT 'internal templates'
                   FROM   icx_cat_item_prices p2
                   WHERE  p.rt_item_id = p2.rt_item_id
                   AND    p2.price_type = 'INTERNAL_TEMPLATE');
Line: 1480

    SELECT 'N'
    INTO   xActiveFlag
    FROM   icx_cat_item_prices p
    WHERE  p.rowid = p_price_row_id
    AND    EXISTS (SELECT 'recently updated internal templates'
                   FROM   icx_cat_item_prices p2
                   WHERE  p.rt_item_id = p2.rt_item_id
                   AND    p2.price_type = 'INTERNAL_TEMPLATE'
                   AND    p2.rowid <> p.rowid
                   --Bug 4349235
                   AND    ((p2.last_update_date > p.last_update_date) OR
                       (p2.last_update_date = p.last_update_date AND
                       EXISTS (SELECT 'exists'
                               FROM  po_reqexpress_lines_all r1,
                                     po_reqexpress_lines_all r2
                               WHERE r2.express_name = p2.template_id
                                     AND r2.sequence_num = p2. template_line_id
                                     AND nvl(r2.org_id, -2) = p2.org_id
                                     AND r1.express_name = p.template_id
                                     AND r1.sequence_num = p. template_line_id
                                     AND nvl(r1.org_id, -2) = p.org_id
                                     AND ((r2.last_update_date > r1.last_update_date)
                                     OR
                  (r2.last_update_date = r1.last_update_date AND  p2.rowid > p.rowid))))));
Line: 1538

             'SELECT p.rt_item_id, t.item_description, '  ||
             '       null, null '  ;
Line: 1558

             'SELECT p.rt_item_id, t.item_description, '  ||
             '       NVL(t.attribute13, t.attribute14), t.Attribute14 '  ;
Line: 1577

             'SELECT p.rt_item_id,  mitl.description, '  ||
             '       null, null ' ;
Line: 1606

             'SELECT p.rt_item_id, t.description, '  ||
             '       null, null '  ;
Line: 1675

          UPDATE icx_cat_items_tlp
          SET    description = xUPItemDescriptions(i),
                 picture = xUPItemPictures(i),
                 picture_url = xUPItemPictureUrls(i),
                 thumbnail_image = xUPItemPictures(i),
                 last_updated_by = ICX_POR_EXTRACTOR.gUserId,
                 last_update_date = SYSDATE,
                 last_update_login = ICX_POR_EXTRACTOR.gLoginId,
                 request_id = ICX_POR_EXTRACTOR.gRequestId,
                 program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
                 program_id = ICX_POR_EXTRACTOR.gProgramId,
                 program_update_date = SYSDATE
          WHERE  rt_item_id = xUPItemRtItemIds(i)
            AND  language = ICX_POR_EXTRACTOR.gBaseLang;
Line: 1697

          UPDATE icx_cat_items_tlp
          SET    description = xUPItemDescriptions(i),
                 last_updated_by = ICX_POR_EXTRACTOR.gUserId,
                 last_update_date = SYSDATE,
                 last_update_login = ICX_POR_EXTRACTOR.gLoginId,
                 request_id = ICX_POR_EXTRACTOR.gRequestId,
                 program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
                 program_id = ICX_POR_EXTRACTOR.gProgramId,
                 program_update_date = SYSDATE
          WHERE  rt_item_id = xUPItemRtItemIds(i)
            AND  language = ICX_POR_EXTRACTOR.gBaseLang;
Line: 1743

  SELECT 'N'
  INTO   xActiveFlag
  FROM   dual
  WHERE  EXISTS (SELECT 'documents'
                 FROM   icx_cat_item_prices p
                 WHERE  p.org_id = p_org_id
                 AND    p.inventory_item_id = p_inventory_item_id
                 AND    p.price_type IN ('TEMPLATE', 'BLANKET',
                                         'QUOTATION', 'GLOBAL_AGREEMENT',
                                         'ASL', 'BULKLOAD'));
Line: 1836

    SELECT 'Y'
    INTO   xMatchTempalteFlag
    FROM   icx_cat_item_prices
    WHERE  rt_item_id = p_rt_item_id
    AND    template_id = p_template_id
    AND    rownum = 1;
Line: 1863

  IF p_action = 'DELETE' THEN
    -- If an active bulkload price is deleted, should set
    -- ASL back to active
    SELECT 'A'
    INTO   xActiveFlag
    FROM   dual
    WHERE  EXISTS (SELECT 'ASL prices'
                   FROM   icx_cat_item_prices
                   WHERE  rt_item_id = p_rt_item_id
                   AND    price_type = 'ASL')
    AND    NOT EXISTS (SELECT 'Contract/template prices'
                       FROM   icx_cat_item_prices
                       WHERE  rt_item_id = p_rt_item_id
                       AND    price_type IN ('TEMPLATE', 'BLANKET',
                                             'QUOTATION',
                                             'GLOBAL_AGREEMENT'));
Line: 1880

    SELECT price_type
    INTO   xPriceType
    FROM   icx_cat_item_prices p
    WHERE  p.active_flag = 'Y'
    AND    (p.rt_item_id = p_rt_item_id OR
            (p.local_rt_item_id = p_rt_item_id AND
             p.price_type = 'GLOBAL_AGREEMENT'))
    AND    rownum = 1;
Line: 1911

  gItemCache.DELETE;
Line: 2085

    xActionMode := 'UPDATE_PRICES';
Line: 2094

      UPDATE icx_cat_item_prices
      SET    rt_item_id = gUPRtItemIds(i),
             price_type = gUPPriceTypes(i),
             active_flag = gUPActiveFlags(i),
             object_version_number = object_version_number + 1,
             asl_id = gUPAslIds(i),
             supplier_site_id = gUPSupplierSiteIds(i),
             contract_id = gUPContractIds(i),
             contract_line_id = gUPContractLineIds(i),
             template_id = gUPTemplateIds(i),
             template_line_id = gUPTemplateLineIds(i),
             inventory_item_id = gUPInventoryItemIds(i),
             mtl_category_id = gUPMtlCategoryIds(i),
             org_id = gUPOrgIds(i),
             search_type = gUPSearchTypes(i),
             unit_price = gUPUnitPrices(i),
             --FPJ FPSL Extractor Changes
             value_basis = gUPValueBasis(i),
             purchase_basis = gUPPurchaseBasis(i),
             allow_price_override_flag = gUPAllowPriceOverrideFlag(i),
             not_to_exceed_price = gUPNotToExceedPrice(i),
             -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
             suggested_quantity = gUPSuggestedQuantities(i),
              -- FPJ Bug# 3110297 jingyu    Add negotiated flag
             negotiated_by_preparer_flag = gUPNegotiatedFlag(i),
             currency = gUPCurrencys(i),
             unit_of_measure = gUPUnitOfMeasures(i),
             functional_price = gUPFunctionalPrices(i),
             supplier_site_code = gUPSupplierSiteCodes(i),
             contract_num = gUPContractNums(i),
             contract_line_num = gUPContractLineNums(i),
             rate_type = gUpRateTypes(i),
             rate_date = gUpRateDates(i),
             rate = gUpRates(i),
             supplier_number = gUpSupplierNumbers(i),
             supplier_contact_id = gUpSupplierContactIds(i),
             item_revision = gUpItemRevisions(i),
             line_type_id = gUpLineTypeIds(i),
             buyer_id = gUpBuyerIds(i),
             last_updated_by = ICX_POR_EXTRACTOR.gUserId,
             last_update_date = gUPLastUpdateDates(i),
             last_update_login = ICX_POR_EXTRACTOR.gLoginId,
        -- Bug#3352834
        request_id = ICX_POR_EXT_ITEM.CURRENT_REQUEST_ID,
             program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
             program_id = ICX_POR_EXTRACTOR.gProgramId,
             program_update_date = SYSDATE
      WHERE  rowid = gUPPriceRowIds(i);
Line: 2146

    xActionMode := 'UPDATE_PRICES_G';
Line: 2155

      UPDATE icx_cat_item_prices
      SET    rt_item_id = gUPGRtItemIds(i),
             object_version_number = object_version_number + 1,
             inventory_item_id = gUPGInventoryItemIds(i),
             mtl_category_id = gUPGMtlCategoryIds(i),
             search_type = gUPGSearchTypes(i),
             unit_price = gUPGUnitPrices(i),
             --FPJ FPSL Extractor Changes
             value_basis = gUPGValueBasis(i),
             purchase_basis = gUPGPurchaseBasis(i),
             allow_price_override_flag = gUPGAllowPriceOverrideFlag(i),
             not_to_exceed_price = gUPGNotToExceedPrice(i),
             -- FPJ Bug# 3110297 jingyu    Add negotiated flag
             negotiated_by_preparer_flag = gUPGNegotiatedFlag(i),
             line_type_id = gUPGLineTypeIds(i),
             currency = gUPGCurrencys(i),
             unit_of_measure = gUPGUnitOfMeasures(i),
             functional_price = gUPGFunctionalPrices(i),
             last_updated_by = ICX_POR_EXTRACTOR.gUserId,
             last_update_date = SYSDATE,
             last_update_login = ICX_POR_EXTRACTOR.gLoginId,
        -- Bug#3352834
        request_id = ICX_POR_EXT_ITEM.CURRENT_REQUEST_ID,
             program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
             program_id = ICX_POR_EXTRACTOR.gProgramId,
             program_update_date = SYSDATE
      WHERE  contract_id = gUPGContractIds(i)
      AND    contract_line_id = gUPGContractLineIds(i)
      AND    price_type = 'GLOBAL_AGREEMENT';
Line: 2188

    xActionMode := 'INSERT_PRICES';
Line: 2197

      INSERT INTO icx_cat_item_prices
      (rt_item_id, price_type,
       active_flag, object_version_number,
       asl_id, supplier_site_id,
       contract_id, contract_line_id,
       template_id, template_line_id,
       inventory_item_id, mtl_category_id,
       org_id, search_type, unit_price,
       --FPJ FPSL Extractor Changes
       value_basis, purchase_basis,
       allow_price_override_flag, not_to_exceed_price,
       -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
       suggested_quantity,
       -- FPJ Bug# 3110297 jingyu    Add negotiated flag
       negotiated_by_preparer_flag,
       currency, unit_of_measure,
       functional_price, supplier_site_code,
       contract_num, contract_line_num,
       rate_type, rate_date, rate,
       supplier_number, supplier_contact_id,
       item_revision, line_type_id, buyer_id,
       price_list_id, last_update_login,
       last_updated_by, last_update_date,
       created_by, creation_date, request_id,
       program_application_id, program_id, program_update_date)
      VALUES
      (gIPRtItemIds(i), gIPPriceTypes(i),
       gIPActiveFlags(i), 1,
       gIPAslIds(i), gIPSupplierSiteIds(i),
       gIPContractIds(i), gIPContractLineIds(i),
       gIPTemplateIds(i), gIPTemplateLineIds(i),
       gIPInventoryItemIds(i), gIPMtlCategoryIds(i),
       gIPOrgIds(i), gIPSearchTypes(i), gIPUnitPrices(i),
       --FPJ FPSL Extractor Changes
       gIPValueBasis(i), gIPPurchaseBasis(i),
       gIPAllowPriceOverrideFlag(i), gIPNotToExceedPrice(i),
       -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
       gIPSuggestedQuantities(i),
       -- FPJ Bug# 3110297 jingyu    Add negotiated flag
       gIPNegotiatedFlag(i),
       gIPCurrencys(i), gIPUnitOfMeasures(i),
       gIPFunctionalPrices(i), gIPSupplierSiteCodes(i),
       gIPContractNums(i), gIPContractLineNums(i),
       gIpRateTypes(i), gIpRateDates(i), gIpRates(i),
       gIpSupplierNumbers(i), gIpSupplierContactIds(i),
       gIpItemRevisions(i), gIpLineTypeIds(i), gIpBuyerIds(i),
       NULL, ICX_POR_EXTRACTOR.gLoginId,
       ICX_POR_EXTRACTOR.gUserId, gIPLastUpdateDates(i),
       ICX_POR_EXTRACTOR.gUserId, SYSDATE,
       -- Bug#3352834
       ICX_POR_EXT_ITEM.CURRENT_REQUEST_ID,
       ICX_POR_EXTRACTOR.gProgramApplicationId,
       ICX_POR_EXTRACTOR.gProgramId, SYSDATE);
Line: 2254

    xActionMode := 'INSERT_ITEMS_B';
Line: 2263

      INSERT INTO icx_cat_items_b
      (rt_item_id, object_version_number, org_id,
       supplier_id, supplier, supplier_part_num,
       supplier_part_auxid, internal_item_id, internal_item_num,
       extractor_updated_flag, catalog_name,
       last_update_login, last_updated_by, last_update_date,
       created_by, creation_date, request_id,
       program_application_id, program_id, program_update_date)
      VALUES
      (gIBRtItemIds(i), 1, gIBOrgIds(i),
       gIBSupplierIds(i), gIBSuppliers(i), gIBSupplierPartNums(i),
       '##NULL##', gIBInternalItemIds(i), gIBInternalItemNums(i),
       'Y', NULL,
       ICX_POR_EXTRACTOR.gLoginId, ICX_POR_EXTRACTOR.gUserId, SYSDATE,
       ICX_POR_EXTRACTOR.gUserId, SYSDATE, ICX_POR_EXTRACTOR.gRequestId,
       ICX_POR_EXTRACTOR.gProgramApplicationId,
       ICX_POR_EXTRACTOR.gProgramId, SYSDATE);
Line: 2284

    xActionMode := 'UPDATE_ITEMS_B';
Line: 2293

      UPDATE icx_cat_items_b
      SET    object_version_number = object_version_number + 1,
             extractor_updated_flag = gUBExtractorUpdatedFlags(i),
             supplier_part_auxid = '##NULL##',
             internal_item_num = gUBInternalItemNums(i),
             catalog_name = NULL,
             last_updated_by = ICX_POR_EXTRACTOR.gUserId,
             last_update_date = SYSDATE,
             last_update_login = ICX_POR_EXTRACTOR.gLoginId,
             request_id = ICX_POR_EXTRACTOR.gRequestId,
             program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
             program_id = ICX_POR_EXTRACTOR.gProgramId,
             program_update_date = SYSDATE
      WHERE  rt_item_id = gUBRtItemIds(i);
Line: 2311

    xActionMode := 'INSERT_ITEMS_TLP';
Line: 2321

        INSERT INTO icx_cat_items_tlp
        (rt_item_id, language, org_id,
         supplier_id, item_source_type, search_type,
         primary_category_id, primary_category_name,
         internal_item_id, internal_item_num,
         supplier, supplier_part_num, supplier_part_auxid, manufacturer,
         manufacturer_part_num, description, comments, alias,
         picture, picture_url, thumbnail_image,
         attachment_url, long_description,
         unspsc_code, availability, lead_time, item_type,
         ctx_desc, last_update_login, last_updated_by, last_update_date,
         created_by, creation_date, request_id,
         program_application_id, program_id, program_update_date)
        VALUES
        (gITRtItemIds(i), gITLanguages(i), gITOrgIds(i),
         gITSupplierIds(i), gITItemSourceTypes(i), gITSearchTypes(i),
         gITPrimaryCategoryIds(i), gITPrimaryCategoryNames(i),
         gITInternalItemIds(i), gITInternalItemNums(i),
         gITSuppliers(i), gITSupplierPartNums(i), '##NULL##', gITManufacturers(i),
         gITManufacturerPartNums(i), gITDescriptions(i), NULL, NULL,
         gITPictures(i), gITPictureURLs(i), gITPictures(i), NULL, NULL,
         NULL, NULL, NULL, NULL,
         NULL, ICX_POR_EXTRACTOR.gLoginId,
         ICX_POR_EXTRACTOR.gUserId, SYSDATE,
         ICX_POR_EXTRACTOR.gUserId, SYSDATE, ICX_POR_EXTRACTOR.gRequestId,
         ICX_POR_EXTRACTOR.gProgramApplicationId,
         ICX_POR_EXTRACTOR.gProgramId, SYSDATE);
Line: 2350

        INSERT INTO icx_cat_items_tlp
        (rt_item_id, language, org_id,
         supplier_id, item_source_type, search_type,
         primary_category_id, primary_category_name,
         internal_item_id, internal_item_num,
         supplier, supplier_part_num, supplier_part_auxid, manufacturer,
         manufacturer_part_num, description, comments, alias,
         attachment_url, long_description,
         unspsc_code, availability, lead_time, item_type,
         ctx_desc, last_update_login, last_updated_by, last_update_date,
         created_by, creation_date, request_id,
         program_application_id, program_id, program_update_date)
        VALUES
        (gITRtItemIds(i), gITLanguages(i), gITOrgIds(i),
         gITSupplierIds(i), gITItemSourceTypes(i), gITSearchTypes(i),
         gITPrimaryCategoryIds(i), gITPrimaryCategoryNames(i),
         gITInternalItemIds(i), gITInternalItemNums(i),
         gITSuppliers(i), gITSupplierPartNums(i), '##NULL##', gITManufacturers(i),
         gITManufacturerPartNums(i), gITDescriptions(i), NULL, NULL,
         NULL, NULL,
         NULL, NULL, NULL, NULL,
         NULL, ICX_POR_EXTRACTOR.gLoginId,
         ICX_POR_EXTRACTOR.gUserId, SYSDATE,
         ICX_POR_EXTRACTOR.gUserId, SYSDATE, ICX_POR_EXTRACTOR.gRequestId,
         ICX_POR_EXTRACTOR.gProgramApplicationId,
         ICX_POR_EXTRACTOR.gProgramId, SYSDATE);
Line: 2381

    xActionMode := 'UPDATE_ITEMS_TLP';
Line: 2391

        UPDATE icx_cat_items_tlp
        SET    item_source_type = gUTItemSourceTypes(i),
               search_type = gUTSearchTypes(i),
               primary_category_id = gUTPrimaryCategoryIds(i),
               primary_category_name = gUTPrimaryCategoryNames(i),
               internal_item_num = gUTInternalItemNums(i),
               description = gUTDescriptions(i),
               picture = gUTPictures(i),
               picture_url = gUTPictureURLs(i),
               supplier_part_auxid = '##NULL##',
               --manufacturer = gUTManufacturers(i),
               --manufacturer_part_num = gUTManufacturerPartNums(i),
               thumbnail_image = gUTPictures(i),
               last_updated_by = ICX_POR_EXTRACTOR.gUserId,
               last_update_date = SYSDATE,
               last_update_login = ICX_POR_EXTRACTOR.gLoginId,
               request_id = ICX_POR_EXTRACTOR.gRequestId,
               program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
               program_id = ICX_POR_EXTRACTOR.gProgramId,
               program_update_date = SYSDATE
        WHERE  rt_item_id = gUTRtItemIds(i)
        AND    language = gUTLanguages(i);
Line: 2415

        UPDATE icx_cat_items_tlp
        SET    item_source_type = gUTItemSourceTypes(i),
               search_type = gUTSearchTypes(i),
               primary_category_id = gUTPrimaryCategoryIds(i),
               primary_category_name = gUTPrimaryCategoryNames(i),
               internal_item_num = gUTInternalItemNums(i),
               description = gUTDescriptions(i),
               supplier_part_auxid = '##NULL##',
               --manufacturer = gUTManufacturers(i),
               --manufacturer_part_num = gUTManufacturerPartNums(i),
               last_updated_by = ICX_POR_EXTRACTOR.gUserId,
               last_update_date = SYSDATE,
               last_update_login = ICX_POR_EXTRACTOR.gLoginId,
               request_id = ICX_POR_EXTRACTOR.gRequestId,
               program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
               program_id = ICX_POR_EXTRACTOR.gProgramId,
               program_update_date = SYSDATE
        WHERE  rt_item_id = gUTRtItemIds(i)
        AND    language = gUTLanguages(i);
Line: 2439

    xActionMode := 'INSERT_CATEGORY_ITEMS';
Line: 2448

      INSERT INTO icx_cat_category_items
      (rt_item_id, rt_category_id,
       last_update_login, last_updated_by, last_update_date,
       created_by, creation_date, request_id,
       program_application_id, program_id, program_update_date)
      VALUES
      (gICRtItemIds(i), gICRtCategoryIds(i),
       ICX_POR_EXTRACTOR.gLoginId, ICX_POR_EXTRACTOR.gUserId, SYSDATE,
       ICX_POR_EXTRACTOR.gUserId, SYSDATE, ICX_POR_EXTRACTOR.gRequestId,
       ICX_POR_EXTRACTOR.gProgramApplicationId,
       ICX_POR_EXTRACTOR.gProgramId, SYSDATE);
Line: 2463

    xActionMode := 'UPDATE_CATEGORY_ITEMS';
Line: 2472

      UPDATE icx_cat_category_items
      SET    rt_category_id = gUCRtCategoryIds(i),
             last_updated_by = ICX_POR_EXTRACTOR.gUserId,
             last_update_date = SYSDATE,
             last_update_login = ICX_POR_EXTRACTOR.gLoginId,
             request_id = ICX_POR_EXTRACTOR.gRequestId,
             program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
             program_id = ICX_POR_EXTRACTOR.gProgramId,
             program_update_date = SYSDATE
      WHERE  rt_item_id = gUCRtItemIds(i)
      AND    rt_category_id = gUCOldRtCategoryIds(i);
Line: 2487

    xActionMode := 'INSERT_EXT_ITEMS';
Line: 2496

      INSERT INTO icx_cat_ext_items_tlp
      (rt_item_id, language, org_id,
       rt_category_id, primary_flag,
       last_update_login, last_updated_by, last_update_date,
       created_by, creation_date, request_id,
       program_application_id, program_id, program_update_date)
      -- bug 2925403
      -- SELECT
      VALUES
       -- gIERtItemIds(i), language_code, gIEOrgIds(i),
      (gIERtItemIds(i), gIELanguages(i), gIEOrgIds(i),
       gIERtCategoryIds(i), 'Y',
       ICX_POR_EXTRACTOR.gLoginId, ICX_POR_EXTRACTOR.gUserId, SYSDATE,
       ICX_POR_EXTRACTOR.gUserId, SYSDATE, ICX_POR_EXTRACTOR.gRequestId,
       ICX_POR_EXTRACTOR.gProgramApplicationId,
       ICX_POR_EXTRACTOR.gProgramId, SYSDATE);
Line: 2519

    xActionMode := 'UPDATE_EXT_ITEMS';
Line: 2528

      UPDATE icx_cat_ext_items_tlp
      SET    rt_category_id = gUERtCategoryIds(i),
             last_updated_by = ICX_POR_EXTRACTOR.gUserId,
             last_update_date = SYSDATE,
             last_update_login = ICX_POR_EXTRACTOR.gLoginId,
             request_id = ICX_POR_EXTRACTOR.gRequestId,
             program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
             program_id = ICX_POR_EXTRACTOR.gProgramId,
             program_update_date = SYSDATE
      WHERE  rt_item_id = gUERtItemIds(i)
      -- bug 2925403
      AND    language = gUELanguages(i)
      AND    rt_category_id = gUEOldRtCategoryIds(i);
Line: 2545

    xActionMode := 'DELETE_ITEM_PRICE';
Line: 2554

      DELETE FROM icx_cat_item_prices
      WHERE  rowid = gDPRowIds(i);
Line: 2559

      DELETE FROM icx_cat_category_items
      WHERE  rt_category_id = gDPTemplateCategoryIds(i)
      AND    rt_item_id = gDPRtItemIds(i);
Line: 2565

    xActionMode := 'DELETE_ITEM_PRICE_GA';
Line: 2573

    xRtItemIds.DELETE;
Line: 2575

      DELETE FROM icx_cat_item_prices
      WHERE  contract_id = gDPGContractIds(i)
      AND    contract_line_id = gDPGContractLineIds(i)
      AND    price_type = 'GLOBAL_AGREEMENT'
      RETURNING local_rt_item_id BULK COLLECT INTO xRtItemIds;
Line: 2584

      INSERT INTO icx_cat_extract_gt
      (rt_item_id, type)
      VALUES (xRtItemIds(i), 'ACTIVE_FLAG');
Line: 2590

    xActionMode := 'UPDATE_PRICES_GA';
Line: 2599

      UPDATE icx_cat_item_prices
      SET    object_version_number = object_version_number + 1,
             functional_price = gUPGAFunctionalPrices(i),
             supplier_site_id = gUPGASupplierSiteIds(i),
             supplier_site_code = gUPGASupplierSiteCodes(i),
             -- bug 2912717: populate line_type, rate info. for GA
             line_type_id = gUPGALineTypeIds(i),
             rate_type = gUPGARateTypes(i),
             rate_date = gUPGARateDates(i),
             rate = gUPGARates(i),
             last_updated_by = ICX_POR_EXTRACTOR.gUserId,
             last_update_date = SYSDATE,
             last_update_login = ICX_POR_EXTRACTOR.gLoginId,
        -- Bug#3352834
        request_id = ICX_POR_EXT_ITEM.CURRENT_REQUEST_ID,
             program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
             program_id = ICX_POR_EXTRACTOR.gProgramId,
             program_update_date = SYSDATE
      WHERE  contract_id = gUPGAContractIds(i)
      AND    contract_line_id = gUPGAContractLineIds(i)
      -- bug 3298502 : Enabled Org Ids
      AND    org_id = gUPGAOrgIds(i)
      AND    price_type = 'GLOBAL_AGREEMENT';
Line: 2625

    xActionMode := 'INSERT_PRICES_GA';
Line: 2634

      INSERT INTO icx_cat_item_prices
      (rt_item_id, price_type,
       active_flag, object_version_number,
       asl_id, supplier_site_id,
       contract_id, contract_line_id,
       template_id, template_line_id,
       inventory_item_id, mtl_category_id,
       org_id, search_type, unit_price,
       --FPJ FPSL Extractor Changes
       value_basis, purchase_basis,
       allow_price_override_flag, not_to_exceed_price,
       -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
       suggested_quantity,
       -- FPJ Bug# 3110297 jingyu    Add negotiated flag
       negotiated_by_preparer_flag,
       currency, unit_of_measure,
       functional_price, supplier_site_code,
       contract_num, contract_line_num,
       -- bug 2912717: populate line_type, rate info. for GA
       line_type_id, rate_type, rate_date, rate,
       local_rt_item_id,
       price_list_id, last_update_login,
       last_updated_by, last_update_date,
       created_by, creation_date, request_id,
       program_application_id, program_id, program_update_date)
      VALUES
      (gIPGARtItemIds(i), 'GLOBAL_AGREEMENT',
       'Y', 1,
       NULL_NUMBER, gIPGASupplierSiteIds(i),
       gIPGAContractIds(i), gIPGAContractLineIds(i),
       NULL_NUMBER, NULL_NUMBER,
       gIPGAInventoryItemIds(i), gIPGAMtlCategoryIds(i),
       gIPGAOrgIds(i), 'SUPPLIER', gIPGAUnitPrices(i),
       --FPJ FPSL Extractor Changes
       gIPGAValueBasis(i), gIPGAPurchaseBasis(i),
       gIPGAAllowPriceOverrideFlag(i), gIPGANotToExceedPrice(i),
       --FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
       NULL,
       -- FPJ Bug# 3110297 jingyu    Add negotiated flag
       gIPGANegotiatedFlag(i),
       gIPGACurrencys(i), gIPGAUnitOfMeasures(i),
       gIPGAFunctionalPrices(i), gIPGASupplierSiteCodes(i),
       gIPGAContractNums(i), gIPGAContractLineNums(i),
       -- bug 2912717: populate line_type_id for GA
       gIPGALineTypeIds(i),
       gIPGARateTypes(i), gIPGARateDates(i), gIPGARates(i),
       -- Use local_rt_item_id to store local rt_item_id
       gIPGALocalRtItemIds(i),
       NULL, ICX_POR_EXTRACTOR.gLoginId,
       ICX_POR_EXTRACTOR.gUserId, SYSDATE,
       ICX_POR_EXTRACTOR.gUserId, SYSDATE,
       -- Bug#3352834
       ICX_POR_EXT_ITEM.CURRENT_REQUEST_ID,
       ICX_POR_EXTRACTOR.gProgramApplicationId,
       ICX_POR_EXTRACTOR.gProgramId, SYSDATE);
Line: 2691

      UPDATE icx_cat_items_tlp
      SET    request_id = ICX_POR_EXTRACTOR.gRequestId
      WHERE  rt_item_id = gIPGARtItemIds(i);
Line: 2708

      UPDATE icx_cat_item_prices
      SET    local_rt_item_id = gSLRALocalRtItemIds(i)
      WHERE  rowid = gSLRRowIds(i);
Line: 2723

      INSERT INTO icx_cat_extract_gt
      (rt_item_id, type)
      VALUES (gCIRtItemIds(i), 'CLEANUP_ITEM');
Line: 2729

    xActionMode := 'TOUCH_UPDATED_GA';
Line: 2738

      INSERT INTO icx_cat_extract_ga_gt
      (contract_id, contract_line_id)
      VALUES (gUGAContractIds(i), gUGAContractLineIds(i));
Line: 2753

      INSERT INTO icx_cat_extract_gt
      (rt_item_id, type)
      VALUES (gTARtItemIds(i), 'ACTIVE_FLAG');
Line: 2768

      INSERT INTO icx_cat_extract_gt
      (rt_item_id, type)
      SELECT rt_item_id, 'ACTIVE_FLAG'
      FROM   icx_cat_items_b
      WHERE  internal_item_id = gTAInvItemIds(i)
      AND    org_id = NVL(gTAInvOrgIds(i), org_id)
      AND    supplier IS NULL;
Line: 2786

  xActionMode := 'DELETE_PURCHASING_ITEM';
Line: 2801

      xRtItemIds.DELETE;
Line: 2803

        DELETE FROM icx_cat_item_prices
        WHERE  inventory_item_id = gDIPurchasingItemIds(i)
        AND    org_id = gDIPurchasingOrgIds(i)
        AND    (search_type = 'SUPPLIER' OR
                price_type = 'PURCHASING_ITEM')
        AND    rownum <= ICX_POR_EXT_UTL.gCommitSize
        RETURNING rt_item_id BULK COLLECT INTO xRtItemIds;
Line: 2818

        INSERT INTO icx_cat_extract_gt
      (rt_item_id, type)
        VALUES (xRtItemIds(i), 'CLEANUP_ITEM');
Line: 2825

        UPDATE icx_cat_item_prices
        SET    active_flag = 'Y'
        WHERE  rt_item_id = xRtItemIds(i)
        AND    price_type IN ('BULKLOAD', 'CONTRACT');
Line: 2832

        DELETE FROM icx_cat_category_items ci
        WHERE  rt_item_id = xRtItemIds(i)
        AND    EXISTS (SELECT  'template header'
                       FROM    icx_cat_categories_tl c
                       WHERE   c.rt_category_id = ci.rt_category_id
                       AND     c.type = ICX_POR_EXT_CLASS.TEMPLATE_HEADER_TYPE);
Line: 2848

  xActionMode := 'DELETE_NULL_PRICE_ITEM';
Line: 2862

      xRtItemIds.DELETE;
Line: 2864

        DELETE FROM icx_cat_item_prices
        WHERE  inventory_item_id = gDINullPriceItemIds(i)
        AND    org_id = gDINullPriceOrgIds(i)
        AND    price_type IN ('ASL', 'PURCHASING_ITEM')
        AND    rownum <= ICX_POR_EXT_UTL.gCommitSize
        RETURNING rt_item_id BULK COLLECT INTO xRtItemIds;
Line: 2874

        INSERT INTO icx_cat_extract_gt
        (rt_item_id, type)
        VALUES (xRtItemIds(i), 'CLEANUP_ITEM');
Line: 2891

  xActionMode := 'DELETE_INTERNAL_ITEM';
Line: 2905

      xRtItemIds.DELETE;
Line: 2907

        DELETE FROM icx_cat_item_prices
        WHERE  inventory_item_id = gDIInternalItemIds(i)
        AND    org_id = gDIInternalOrgIds(i)
        AND    search_type = 'INTERNAL'
        AND    rownum <= ICX_POR_EXT_UTL.gCommitSize
        RETURNING rt_item_id BULK COLLECT INTO xRtItemIds;
Line: 2917

        INSERT INTO icx_cat_extract_gt
        (rt_item_id, type)
        VALUES (xRtItemIds(i), 'CLEANUP_ITEM');
Line: 2979

    SELECT i.rt_item_id,
           t.primary_category_id,
           ICX_POR_EXT_ITEM.getMatchTempalteFlag(gCurrentPrice.price_type,
                                   i.rt_item_id,
                                   gCurrentPrice.template_id) match_template_flag
    FROM   icx_cat_items_b i,
           icx_cat_items_tlp t
    WHERE  i.internal_item_id =  gCurrentPrice.internal_item_id
    AND    i.org_id = gCurrentPrice.org_id
    AND    (i.supplier IS NULL AND gCurrentPrice.supplier IS NULL OR
            i.supplier = gCurrentPrice.supplier)
    AND    (i.supplier_part_num IS NULL AND
            gCurrentPrice.supplier_part_num = TO_CHAR(NULL_NUMBER) OR
            i.supplier_part_num = gCurrentPrice.supplier_part_num)
    AND    t.rt_item_id = i.rt_item_id
    AND    rownum = 1
    UNION ALL
    SELECT p.local_rt_item_id,
           TO_NUMBER(NULL_NUMBER) primary_category_id, -- for Global Agreement match
           'N' match_template_flag
    FROM   icx_cat_items_b i,
           icx_cat_item_prices p
    WHERE  i.internal_item_id =  gCurrentPrice.internal_item_id
    AND    (i.supplier IS NULL AND gCurrentPrice.supplier IS NULL OR
            i.supplier = gCurrentPrice.supplier)
    AND    (i.supplier_part_num IS NULL AND
            gCurrentPrice.supplier_part_num = TO_CHAR(NULL_NUMBER) OR
            i.supplier_part_num = gCurrentPrice.supplier_part_num)
    AND    p.rt_item_id = i.rt_item_id
    AND    p.price_type = 'GLOBAL_AGREEMENT'
    AND    p.org_id = gCurrentPrice.org_id
    AND    rownum = 1;
Line: 3022

    SELECT p.rt_item_id,
           t.primary_category_id,
           ICX_POR_EXT_ITEM.getMatchTempalteFlag(gCurrentPrice.price_type,
                                   p.rt_item_id,
                                   gCurrentPrice.template_id) match_template_flag
    FROM   icx_cat_item_prices p,
           icx_cat_items_tlp t
    WHERE  p.inventory_item_id = gCurrentPrice.internal_item_id
    AND    p.org_id = gCurrentPrice.org_id
    AND    p.price_type IN ('PURCHASING_ITEM',
                            'INTERNAL_TEMPLATE',
                            'INTERNAL_ITEM')
    AND    t.rt_item_id = p.rt_item_id
    AND    rownum = 1;
Line: 3047

    SELECT i.rt_item_id,
           t.primary_category_id,
           ICX_POR_EXT_ITEM.getMatchTempalteFlag(gCurrentPrice.price_type,
                                   i.rt_item_id,
                                   gCurrentPrice.template_id) match_template_flag
    FROM   icx_cat_items_b i,
           icx_cat_items_tlp t
    WHERE  i.internal_item_id IS NULL
    AND    i.org_id = gCurrentPrice.org_id
    AND    i.supplier = gCurrentPrice.supplier
    AND    i.supplier_part_num = gCurrentPrice.supplier_part_num
    AND    i.supplier_part_auxid = '##NULL##'
    AND    t.rt_item_id = i.rt_item_id
    AND    rownum = 1
    UNION ALL
    SELECT p.local_rt_item_id,
           TO_NUMBER(NULL_NUMBER) primary_category_id,
           'N' match_template_flag
    FROM   icx_cat_items_b i,
           icx_cat_item_prices p
    WHERE  i.internal_item_id IS NULL
    AND    i.supplier = gCurrentPrice.supplier
    AND    i.supplier_part_num = gCurrentPrice.supplier_part_num
    AND    i.supplier_part_auxid = '##NULL##'
    AND    p.rt_item_id = i.rt_item_id
    AND    p.price_type = 'GLOBAL_AGREEMENT'
    AND    p.org_id = gCurrentPrice.org_id
    AND    rownum = 1;
Line: 3086

    SELECT p.rt_item_id,
           t.primary_category_id,
           ICX_POR_EXT_ITEM.getMatchTempalteFlag(gCurrentPrice.price_type,
                                   p.rt_item_id,
                                   gCurrentPrice.template_id) match_template_flag
    FROM   icx_cat_item_prices p,
           icx_cat_items_tlp t
    WHERE  p.inventory_item_id IS NULL
    AND    p.org_id = gCurrentPrice.org_id
    AND    p.contract_id = gCurrentPrice.contract_id
    AND    p.contract_line_id = gCurrentPrice.contract_line_id
    AND    EXISTS (SELECT 'item with same supplier/supplier_part_num'
                   FROM   icx_cat_items_b i
                   WHERE  i.rt_item_id = p.rt_item_id
                   AND    i.org_id = p.org_id
                   AND    (i.supplier IS NULL AND
                           gCurrentPrice.supplier IS NULL OR
                           i.supplier = gCurrentPrice.supplier)
                   AND    (i.supplier_part_num IS NULL AND
                           gCurrentPrice.supplier_part_num =
                             TO_CHAR(NULL_NUMBER) OR
                           i.supplier_part_num = gCurrentPrice.supplier_part_num))
    AND    t.rt_item_id = p.rt_item_id
    AND    rownum = 1
    UNION ALL
    SELECT p.local_rt_item_id,
           TO_NUMBER(NULL_NUMBER) primary_category_id,
           'N' match_template_flag
    FROM   icx_cat_item_prices p
    WHERE  p.inventory_item_id IS NULL
    AND    p.org_id = gCurrentPrice.org_id
    AND    p.contract_id = gCurrentPrice.contract_id
    AND    p.contract_line_id = gCurrentPrice.contract_line_id
    AND    p.price_type = 'GLOBAL_AGREEMENT'
    AND    EXISTS (SELECT 'item with same supplier/supplier_part_num'
                   FROM   icx_cat_items_b i
                   WHERE  i.rt_item_id = p.rt_item_id
                   AND    (i.supplier IS NULL AND
                           gCurrentPrice.supplier IS NULL OR
                           i.supplier = gCurrentPrice.supplier)
                   AND    (i.supplier_part_num IS NULL AND
                           gCurrentPrice.supplier_part_num =
                             TO_CHAR(NULL_NUMBER) OR
                           i.supplier_part_num = gCurrentPrice.supplier_part_num))
    AND    rownum = 1;
Line: 3140

    SELECT i.rt_item_id,
           TO_NUMBER(NULL) primary_category_id,
           TO_CHAR(NULL) match_template_flag
    FROM   icx_cat_items_b i
    WHERE  i.internal_item_id =  gCurrentPrice.internal_item_id
    AND    i.org_id = gCurrentPrice.org_id
    AND    (i.supplier IS NULL AND gCurrentPrice.supplier IS NULL OR
            i.supplier = gCurrentPrice.supplier)
    AND    (i.supplier_part_num IS NULL AND
            gCurrentPrice.supplier_part_num = TO_CHAR(NULL_NUMBER) OR
            i.supplier_part_num = gCurrentPrice.supplier_part_num)
    AND    rownum = 1;
Line: 3163

    SELECT i.rt_item_id,
           TO_NUMBER(NULL) primary_category_id,
           TO_CHAR(NULL) match_template_flag
    FROM   icx_cat_items_b i
    WHERE  i.internal_item_id IS NULL
    AND    i.org_id = gCurrentPrice.org_id
    AND    i.supplier = gCurrentPrice.supplier
    AND    i.supplier_part_num = gCurrentPrice.supplier_part_num
    AND    i.supplier_part_auxid = '##NULL##'
    AND    rownum = 1;
Line: 3180

    SELECT p.rt_item_id,
           TO_NUMBER(NULL) primary_category_id,
           TO_CHAR(NULL) match_template_flag
    FROM   icx_cat_item_prices p
    WHERE  p.inventory_item_id IS NULL
    AND    p.org_id = gCurrentPrice.org_id
    AND    p.contract_id = gCurrentPrice.contract_id
    AND    p.contract_line_id = gCurrentPrice.contract_line_id
    AND    EXISTS (SELECT 'item with same supplier/supplier_part_num'
                   FROM   icx_cat_items_b i
                   WHERE  i.rt_item_id = p.rt_item_id
                   AND    i.org_id = p.org_id
                   AND    (i.supplier IS NULL AND
                           gCurrentPrice.supplier IS NULL OR
                           i.supplier = gCurrentPrice.supplier)
                   AND    (i.supplier_part_num IS NULL AND
                           gCurrentPrice.supplier_part_num =
                             TO_CHAR(NULL_NUMBER) OR
                           i.supplier_part_num = gCurrentPrice.supplier_part_num))
    AND    rownum = 1;
Line: 3292

    RETURN DELETE_PRICE;
Line: 3376

      SELECT icx_por_itemid.nextval
      INTO   xRtItemId
      FROM   dual;
Line: 3452

      SELECT icx_por_itemid.nextval
      INTO   xRtItemId
      FROM   dual;
Line: 3502

PROCEDURE updateItemPrices IS
  xErrLoc       PLS_INTEGER := 100;
Line: 3547

  gUPLastUpdateDates(xIndex) := gCurrentPrice.last_update_date;
Line: 3577

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.updateItemPrices-'||
      xErrLoc||' '||SQLERRM);
Line: 3580

END updateItemPrices;
Line: 3582

PROCEDURE insertItemPrices IS
  xErrLoc       PLS_INTEGER := 100;
Line: 3626

  gIPLastUpdateDates(xIndex) := gCurrentPrice.last_update_date;
Line: 3632

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.insertItemPrices-'||
      xErrLoc||' '||SQLERRM);
Line: 3635

END insertItemPrices;
Line: 3637

PROCEDURE insertItemsB IS
  xErrLoc       PLS_INTEGER := 100;
Line: 3664

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.insertItemsB-'||
      xErrLoc||' '||SQLERRM);
Line: 3667

END insertItemsB;
Line: 3669

PROCEDURE updateItemsB IS
  xErrLoc       PLS_INTEGER := 100;
Line: 3680

  gUBExtractorUpdatedFlags(xIndex) := 'Y';
Line: 3686

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.updateItemsB-'||
      xErrLoc||' '||SQLERRM);
Line: 3689

END updateItemsB;
Line: 3691

PROCEDURE insertItemsTLP IS
  xString       VARCHAR2(2000);
Line: 3706

      'SELECT m.description, ' ||
      'm.language, ' ||
      'ctl.category_name ';
Line: 3727

      'AND m.language IN (SELECT language_code ' ||
      'FROM fnd_languages ' ||
      'WHERE installed_flag IN (''B'', ''I'')) ';
Line: 3795

    xString := 'SELECT language_code ' || 'FROM fnd_languages ' ||  'WHERE installed_flag IN (''B''';
Line: 3847

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.insertItemsTLP-'||
      xErrLoc||' '||SQLERRM);
Line: 3850

END insertItemsTLP;
Line: 3852

PROCEDURE updateItemsTLP IS
  xString       VARCHAR2(2000);
Line: 3867

      'SELECT m.description, ' ||
      'm.language, ' ||
      'ctl.category_name, ' ||
      't.rt_item_id ';
Line: 3891

      'AND m.language IN (SELECT language_code ' ||
      'FROM fnd_languages ' ||
      'WHERE installed_flag IN (''B'', ''I'')) ' ||
      'AND m.language = t.language (+) ' ||
      'AND t.rt_item_id (+) = :rt_item_id';
Line: 3978

    xString := 'SELECT f.language_code, i.rt_item_id ' ||
               'FROM fnd_languages f, icx_cat_items_tlp i ' ||
                'WHERE ' ||
                   'f.language_code = i.language(+) AND ' ||
                   'i.rt_item_id(+) = :rt_item_id AND ' ||
                   'f.installed_flag IN (''B''';
Line: 4063

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.updateItemsTLP-'||
      xErrLoc||' '||SQLERRM);
Line: 4066

END updateItemsTLP;
Line: 4069

PROCEDURE insertExtItemsTLP IS
  xString       VARCHAR2(2000);
Line: 4082

      'SELECT m.language ';
Line: 4099

        'AND m.language IN (SELECT language_code ' ||
        'FROM fnd_languages ' ||
        'WHERE installed_flag IN (''B'', ''I'')) ';
Line: 4132

        'SELECT language_code ' ||
        'FROM fnd_languages ' ||
        'WHERE installed_flag IN (''B''';
Line: 4170

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.insertExtItemsTLP-'||
      xErrLoc||' '||SQLERRM);
Line: 4173

END insertExtItemsTLP;
Line: 4176

PROCEDURE updateExtItemsTLP IS
  xString       VARCHAR2(2000);
Line: 4190

      'SELECT m.language, ' ||
      't.rt_item_id ';
Line: 4209

      'AND m.language IN (SELECT language_code ' ||
      'FROM fnd_languages ' ||
      'WHERE installed_flag IN (''B'', ''I'')) ' ||
      'AND m.language = t.language (+) ' ||
      'AND t.rt_item_id (+) = :rt_item_id';
Line: 4264

        'SELECT f.language_code, i.rt_item_id ' ||
        'FROM fnd_languages f, icx_cat_ext_items_tlp i ' ||
        'WHERE ' ||
        'f.language_code = i.language(+) AND ' ||
        'i.rt_item_id(+) = :rt_item_id AND ' ||
        'f.installed_flag IN (''B''';
Line: 4328

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.updateExtItemsTLP-'||
      xErrLoc||' '||SQLERRM);
Line: 4331

END updateExtItemsTLP;
Line: 4333

PROCEDURE insertPrimaryCategoryItems IS
  xErrLoc       PLS_INTEGER := 100;
Line: 4356

      'ICX_POR_EXT_ITEM.insertPrimaryCategoryItems-'||
      xErrLoc||' '||SQLERRM);
Line: 4359

END insertPrimaryCategoryItems;
Line: 4361

PROCEDURE updatePrimaryCategoryItems IS
  xErrLoc       PLS_INTEGER := 100;
Line: 4385

      'ICX_POR_EXT_ITEM.updatePrimaryCategoryItems-'||
      xErrLoc||' '||SQLERRM);
Line: 4388

END updatePrimaryCategoryItems;
Line: 4390

PROCEDURE insertTemplateCategoryItems IS
  xErrLoc       PLS_INTEGER := 100;
Line: 4404

      'ICX_POR_EXT_ITEM.insertTemplateCategoryItems-'||
      xErrLoc||' '||SQLERRM);
Line: 4407

END insertTemplateCategoryItems;
Line: 4424

PROCEDURE touchUpdatedGA(pContractId            IN NUMBER,
                         pContractLineId        IN NUMBER)
IS
  xErrLoc       PLS_INTEGER := 100;
Line: 4437

      'ICX_POR_EXT_ITEM.touchUpdatedGA-'||
      xErrLoc||' '||SQLERRM);
Line: 4440

END touchUpdatedGA;
Line: 4477

PROCEDURE deleteItemPrices IS
  xErrLoc       PLS_INTEGER := 100;
Line: 4484

      'Enter deleteItemPrices()');
Line: 4514

      'ICX_POR_EXT_ITEM.deleteItemPrices-'||
      xErrLoc||' '||SQLERRM);
Line: 4517

END deleteItemPrices;
Line: 4519

PROCEDURE deleteItem IS
  xErrLoc       PLS_INTEGER := 100;
Line: 4526

      'Enter deleteItem()');
Line: 4555

      'ICX_POR_EXT_ITEM.deleteItem-'||
      xErrLoc||' '||SQLERRM);
Line: 4558

END deleteItem;
Line: 4560

PROCEDURE updateItemPricesGA IS
  xErrLoc       PLS_INTEGER := 100;
Line: 4567

      'Enter updateItemPricesGA()');
Line: 4590

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.updateItemPricesGA-'||
      xErrLoc||' '||SQLERRM);
Line: 4593

END updateItemPricesGA;
Line: 4595

PROCEDURE insertItemPricesGA IS
  xErrLoc       PLS_INTEGER := 100;
Line: 4602

      'Enter insertItemPricesGA()');
Line: 4640

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.insertItemPricesGA-'||
      xErrLoc||' '||SQLERRM);
Line: 4643

END insertItemPricesGA;
Line: 4774

      updateItemPrices;
Line: 4779

        insertItemPrices;
Line: 4782

        updateItemPrices;
Line: 4786

      updateItemPrices;
Line: 4788

      updateItemsB;
Line: 4790

      updateItemsTLP;
Line: 4793

      updateExtItemsTLP;
Line: 4798

        updatePrimaryCategoryItems;
Line: 4804

        insertItemPrices;
Line: 4807

        updateItemPrices;
Line: 4810

      updateItemsB;
Line: 4812

      updateItemsTLP;
Line: 4815

      updateExtItemsTLP;
Line: 4820

        updatePrimaryCategoryItems;
Line: 4825

        insertTemplateCategoryItems;
Line: 4839

        insertItemPrices;
Line: 4842

        updateItemPrices;
Line: 4845

      insertItemsB;
Line: 4847

      insertItemsTLP;
Line: 4850

      insertExtItemsTLP;
Line: 4852

      insertPrimaryCategoryItems;
Line: 4856

        insertTemplateCategoryItems;
Line: 4858

    ELSIF (xItemStatus = DELETE_PRICE) THEN
      xErrLoc := 600;
Line: 4865

          deleteItemPrices;
Line: 4868

          deleteItem;
Line: 4879

      touchUpdatedGA(gCurrentPrice.contract_id,
                     gCurrentPrice.contract_line_id);
Line: 4887

                        ITEM_MATCH, DELETE_PRICE))
    THEN
      touchCleanupItem(gCurrentPrice.price_rt_item_id);
Line: 4911

    ELSIF xItemStatus IN (NEW_ITEM, NEW_GA_ITEM, DELETE_PRICE) THEN
      -- We need to reset actice_flag for price_rt_item_id
      IF gCurrentPrice.price_rt_item_id IS NOT NULL THEN
        touchRtItemActiveFlag(gCurrentPrice.price_rt_item_id);
Line: 4934

      IF (xItemStatus = DELETE_PRICE) THEN
        IF (gCurrentPrice.price_rowid IS NOT NULL) THEN
          xErrLoc := 900;
Line: 4937

          deleteItemPrices;
Line: 4942

          updateItemPricesGA;
Line: 4945

          insertItemPricesGA;
Line: 4963

    IF xItemStatus IN (ITEM_MATCH, NEW_ITEM, DELETE_PRICE) THEN
      -- We need to reset actice_flag for rt_item_id
      IF gCurrentPrice.rt_item_id IS NOT NULL THEN
        touchRtItemActiveFlag(gCurrentPrice.rt_item_id);
Line: 5041

  cUpdatedPriceRows   tCursorType;
Line: 5045

  l_last_update_date              DBMS_SQL.DATE_TABLE;
Line: 5130

  open cUpdatedPriceRows for cSqlString;
Line: 5138

    l_document_type.DELETE;
Line: 5139

    l_last_update_date.DELETE;
Line: 5140

    l_org_id.DELETE;
Line: 5141

    l_supplier_id.DELETE;
Line: 5142

    l_supplier_part_num.DELETE;
Line: 5143

    l_internal_item_id.DELETE;
Line: 5144

    l_mtl_category_id.DELETE;
Line: 5145

    l_category_key.DELETE;
Line: 5146

    l_description.DELETE;
Line: 5147

    l_picture.DELETE;
Line: 5148

    l_picture_url.DELETE;
Line: 5149

    l_price_type.DELETE;
Line: 5150

    l_asl_id.DELETE;
Line: 5151

    l_supplier_site_id.DELETE;
Line: 5152

    l_contract_id.DELETE;
Line: 5153

    l_contract_line_id.DELETE;
Line: 5154

    l_template_id.DELETE;
Line: 5155

    l_template_line_id.DELETE;
Line: 5156

    l_price_search_type.DELETE;
Line: 5157

    l_unit_price.DELETE;
Line: 5159

    l_value_basis.DELETE;
Line: 5160

    l_purchase_basis.DELETE;
Line: 5161

    l_allow_price_override_flag.DELETE;
Line: 5162

    l_not_to_exceed_price.DELETE;
Line: 5164

    l_suggested_quantity.DELETE;
Line: 5166

    l_negotiated_by_preparer_flag.DELETE;
Line: 5167

    l_currency.DELETE;
Line: 5168

    l_unit_of_measure.DELETE;
Line: 5169

    l_functional_price.DELETE;
Line: 5170

    l_contract_num.DELETE;
Line: 5171

    l_contract_line_num.DELETE;
Line: 5172

    l_manufacturer.DELETE;
Line: 5173

    l_manufacturer_part_num.DELETE;
Line: 5174

    l_rate_type.DELETE;
Line: 5175

    l_rate_date.DELETE;
Line: 5176

    l_rate.DELETE;
Line: 5177

    l_supplier_number.DELETE;
Line: 5178

    l_supplier_contact_id.DELETE;
Line: 5179

    l_item_revision.DELETE;
Line: 5180

    l_line_type_id.DELETE;
Line: 5181

    l_buyer_id.DELETE;
Line: 5182

    l_global_agreement_flag.DELETE;
Line: 5183

    l_status.DELETE;
Line: 5184

    l_supplier.DELETE;
Line: 5185

    l_supplier_site_code.DELETE;
Line: 5186

    l_internal_item_num.DELETE;
Line: 5187

    l_inventory_organization_id.DELETE;
Line: 5188

    l_item_source_type.DELETE;
Line: 5189

    l_item_search_type.DELETE;
Line: 5190

    l_primary_category_id.DELETE;
Line: 5191

    l_primary_category_name.DELETE;
Line: 5192

    l_template_category_id.DELETE;
Line: 5193

    l_price_rt_item_id.DELETE;
Line: 5194

    l_price_internal_item_id.DELETE;
Line: 5195

    l_price_supplier_id.DELETE;
Line: 5196

    l_price_supplier_part_num.DELETE;
Line: 5197

    l_price_contract_line_id.DELETE;
Line: 5198

    l_price_mtl_category_id.DELETE;
Line: 5199

    l_match_primary_category_id.DELETE;
Line: 5200

    l_rt_item_id.DELETE;
Line: 5201

    l_local_rt_item_id.DELETE;
Line: 5202

    l_match_template_flag.DELETE;
Line: 5203

    l_active_flag.DELETE;
Line: 5204

    l_price_rowid.DELETE;
Line: 5218

      EXIT WHEN cUpdatedPriceRows%NOTFOUND;
Line: 5222

        FETCH cUpdatedPriceRows INTO
        l_document_type(i), l_last_update_date(i), l_org_id(i),
        l_supplier_id(i), l_supplier(i), l_supplier_site_code(i),
        l_supplier_part_num(i), l_internal_item_id(i), l_internal_item_num(i),
        l_inventory_organization_id(i), l_item_source_type(i), l_item_search_type(i),
        l_mtl_category_id(i), l_category_key(i), l_description(i),
        l_picture(i), l_picture_url(i), l_price_type(i),
        l_asl_id(i), l_supplier_site_id(i), l_contract_id(i),
        l_contract_line_id(i), l_template_id(i), l_template_line_id(i),
        l_price_search_type(i), l_unit_price(i),
        --FPJ FPSL Extractor Changes
        l_value_basis(i), l_purchase_basis(i),
        l_allow_price_override_flag(i), l_not_to_exceed_price(i),
        -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
        l_suggested_quantity(i),
        -- FPJ Bug# 3110297 jingyu    Add negotiated flag
        l_negotiated_by_preparer_flag(i),
        l_currency(i),
        l_unit_of_measure(i), l_functional_price(i), l_contract_num(i),
        l_contract_line_num(i), l_manufacturer(i), l_manufacturer_part_num(i),
        l_rate_type(i), l_rate_date(i), l_rate(i), l_supplier_number(i),
        l_supplier_contact_id(i), l_item_revision(i), l_line_type_id(i),
        l_buyer_id(i), l_global_agreement_flag(i), l_status(i),
        l_primary_category_id(i), l_primary_category_name(i), l_template_category_id(i),
        l_price_rt_item_id(i), l_price_internal_item_id(i), l_price_supplier_id(i),
        l_price_supplier_part_num(i), l_price_contract_line_id(i),
        l_price_mtl_category_id(i), l_match_primary_category_id(i), l_rt_item_id(i),
        l_local_rt_item_id(i), l_match_template_flag(i), l_active_flag(i), l_price_rowid(i);
Line: 5250

        EXIT WHEN cUpdatedPriceRows%NOTFOUND;
Line: 5254

      FETCH cUpdatedPriceRows
      BULK  COLLECT INTO
        l_document_type, l_last_update_date, l_org_id,
        l_supplier_id, l_supplier, l_supplier_site_code,
        l_supplier_part_num, l_internal_item_id, l_internal_item_num,
        l_inventory_organization_id, l_item_source_type, l_item_search_type,
        l_mtl_category_id, l_category_key, l_description,
        l_picture, l_picture_url, l_price_type,
        l_asl_id, l_supplier_site_id, l_contract_id,
        l_contract_line_id, l_template_id, l_template_line_id,
        l_price_search_type, l_unit_price,
        --FPJ FPSL Extractor Changes
        l_value_basis, l_purchase_basis,
        l_allow_price_override_flag, l_not_to_exceed_price,
        -- new FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
        l_suggested_quantity,
        -- FPJ Bug# 3110297 jingyu    Add negotiated flag
        l_negotiated_by_preparer_flag,
        l_currency,
        l_unit_of_measure, l_functional_price, l_contract_num,
        l_contract_line_num, l_manufacturer, l_manufacturer_part_num,
        l_rate_type, l_rate_date, l_rate, l_supplier_number,
        l_supplier_contact_id, l_item_revision, l_line_type_id,
        l_buyer_id, l_global_agreement_flag, l_status,
        l_primary_category_id, l_primary_category_name, l_template_category_id,
        l_price_rt_item_id, l_price_internal_item_id, l_price_supplier_id,
        l_price_supplier_part_num, l_price_contract_line_id,
        l_price_mtl_category_id, l_match_primary_category_id, l_rt_item_id,
        l_local_rt_item_id, l_match_template_flag, l_active_flag, l_price_rowid
      LIMIT ICX_POR_EXT_UTL.gCommitSize;
Line: 5291

      gCurrentPrice.last_update_date := l_last_update_date(i);
Line: 5391

      IF (cUpdatedPriceRows%ISOPEN) THEN
        xErrLoc := 284;
Line: 5393

        CLOSE cUpdatedPriceRows;
Line: 5395

        OPEN cUpdatedPriceRows for cSqlString;
Line: 5412

  IF (cUpdatedPriceRows%ISOPEN) THEN
    xErrLoc := 410;
Line: 5414

    CLOSE cUpdatedPriceRows;
Line: 5420

    IF (cUpdatedPriceRows%ISOPEN) THEN
      CLOSE cUpdatedPriceRows;
Line: 5429

    IF (cUpdatedPriceRows%ISOPEN) THEN
      CLOSE cUpdatedPriceRows;
Line: 5476

  SELECT name
  INTO l_owning_ou_name
  FROM hr_all_organization_units
  WHERE organization_id = x_owning_org_id;
Line: 5502

    SELECT     currency_code
    INTO       l_to_currency
    FROM       GL_SETS_OF_BOOKS
    WHERE      set_of_books_id = x_set_of_books_id;
Line: 5508

    SELECT USER_CONVERSION_TYPE
    INTO   l_user_conv_type
    FROM   GL_DAILY_CONVERSION_TYPES
    WHERE  CONVERSION_TYPE = x_conversion_type;
Line: 5544

  xSelectStr    VARCHAR2(4000) := NULL;
Line: 5576

  SELECT unit_of_measure
  INTO   xOneValidUomCode
  FROM   mtl_units_of_measure_tl
  WHERE  rownum = 1;
Line: 5584

    xSelectStr :=
      'SELECT /*+ LEADING(doc) */ ' ||
      'doc.*, ' ||
      'ic1.rt_category_id primary_category_id, ' ||
      'ic1.category_name primary_category_name, ';
Line: 5590

      xSelectStr := xSelectStr ||
        'ic2.rt_category_id template_category_id, ';
Line: 5593

      xSelectStr := xSelectStr ||
        'TO_NUMBER(NULL) template_category_id, ';
Line: 5596

    xSelectStr := xSelectStr ||
      'p.rt_item_id price_rt_item_id, ' ||
      'NVL(i.internal_item_id, '||NULL_NUMBER||
       ') price_internal_item_id, ' ||
      'NVL(i.supplier_id, '||NULL_NUMBER||') price_supplier_id, ' ||
      'NVL(i.supplier_part_num, TO_CHAR('||NULL_NUMBER||
      ')) price_supplier_part_num, ' ||
      'p.contract_line_id price_contract_line_id, ' ||
      'p.mtl_category_id  price_mtl_category_id, ' ||
      'ic3.rt_category_id match_primary_category_id, ' ||
      'TO_NUMBER(NULL) rt_item_id, ' ||
      'TO_NUMBER(NULL) local_rt_item_id, '||
      '''N'' match_template_flag, ';
Line: 5612

      xSelectStr := xSelectStr ||
      'DECODE(doc.status, ' || ICX_POR_EXT_DIAG.VALID_FOR_EXTRACT ||
      ', ICX_POR_EXT_ITEM.getItemActiveFlag(doc.internal_item_id, doc.org_id), ' ||
      'NULL) active_flag, ';
Line: 5617

      xSelectStr := xSelectStr ||
      'p.active_flag active_flag, ';
Line: 5620

    xSelectStr := xSelectStr ||
      'ROWIDTOCHAR(p.rowid) price_rowid ';
Line: 5627

        'SELECT DECODE(prl.source_type_code, ''VENDOR'', '||
        TEMPLATE_TYPE||', '||
        INTERNAL_TEMPLATE_TYPE||') document_type, '||
        'greatest(prl.last_update_date, prh.last_update_date) ' ||
        'last_update_date, '||
        'NVL(prl.org_id, '||NULL_NUMBER||') org_id, '||
        'NVL(nvl(ph.vendor_id, prl.suggested_vendor_id), '||
        NULL_NUMBER||') supplier_id, '||
        'icx_pv.vendor_name supplier, '||
        'pvs.vendor_site_code supplier_site_code, '||
        'NVL(nvl(pl.vendor_product_num, prl.suggested_vendor_product_code), '||
        'TO_CHAR('||NULL_NUMBER||')) supplier_part_num, '||
        'NVL(prl.item_id, '||NULL_NUMBER||') internal_item_id, '||
        'mi.concatenated_segments internal_item_num, '||
        'mi.organization_id inventory_organization_id, '||
        'ICX_POR_EXT_ITEM.getItemSourceType(DECODE(prl.source_type_code, ''VENDOR'', '||
        '''TEMPLATE'', ''INTERNAL_TEMPLATE''), prl.item_id, ' ||
        'mi.purchasing_enabled_flag, mi.outside_operation_flag, ' ||
        'mi.list_price_per_unit, l.load_item_master, ' ||
        'mi.internal_order_enabled_flag, l.load_internal_item) item_source_type, ' ||
        'ICX_POR_EXT_ITEM.getSearchType(DECODE(prl.source_type_code, ''VENDOR'', '||
        '''TEMPLATE'', ''INTERNAL_TEMPLATE''), prl.item_id, ' ||
        'mi.purchasing_enabled_flag, mi.outside_operation_flag, ' ||
        'mi.list_price_per_unit, l.load_item_master, ' ||
        'mi.internal_order_enabled_flag, l.load_internal_item) item_search_type, ' ||
        'nvl(pl.category_id, prl.category_id) mtl_category_id, '||
        'TO_CHAR(nvl(pl.category_id, prl.category_id)) category_key, '||
        'prl.item_description description, '||
        'TO_CHAR(NULL) picture, '||
        'TO_CHAR(NULL) picture_url, '||
        'DECODE(prl.source_type_code, ''VENDOR'', '||
        '''TEMPLATE'', ''INTERNAL_TEMPLATE'') price_type, '||
        'TO_NUMBER('||NULL_NUMBER||') asl_id, '||
        'NVL(nvl(ph.vendor_site_id, prl.suggested_vendor_site_id), '||
        ''||NULL_NUMBER||') supplier_site_id, '||
        'NVL(prl.po_header_id, '||NULL_NUMBER||') contract_id, '||
        'NVL(prl.po_line_id, '||NULL_NUMBER||') contract_line_id, '||
        'prl.express_name template_id, '||
        'prl.sequence_num template_line_id, '||
        'DECODE(prl.source_type_code, ''VENDOR'', '||
        '''SUPPLIER'', ''INTERNAL'') price_search_type, '||
        --FPJ FPSL Extractor Changes
        -- If value_basis i.e. order_type_lookup_code is 'FIXED PRICE'
        -- Then extractor will store amount in unit_price
        'DECODE(prl.source_type_code, ''VENDOR'', '||
        'DECODE(pltb.order_type_lookup_code, ''FIXED PRICE'', '||
        'nvl(pl.amount, prl.amount), '||
        'nvl(pl.unit_price, prl.unit_price)), NULL) unit_price, '||
        --FPJ FPSL Extractor Changes
        'pltb.order_type_lookup_code value_basis, '||
        'pltb.purchase_basis purchase_basis, '||
        --FPJ FPSL Extractor Changes
        --allow_price_override_flag and not_to_exceed_price are not
        --supported in req templates, so we will get it directly
        --from po lines if the req template is sourced from a po.
        'pl.allow_price_override_flag allow_price_override_flag, '||
        'pl.not_to_exceed_price not_to_exceed_price, '||
        -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
        'prl.suggested_quantity suggested_quantity, '||
        -- FPJ Bug# 3110297 jingyu    Add negotiated flag
        'nvl(pl.negotiated_by_preparer_flag, prl.negotiated_by_preparer_flag) negotiated_by_preparer_flag, '||
        'DECODE(prl.source_type_code, ''VENDOR'', '||
        'nvl(ph.currency_code, gsb.currency_code), NULL) currency, '||

        /* Bug#3693294 : srmani
         * An Outer Join is required with UOMTL Table, as the Fixed Price Line Type Items do not have
         * a UOM (is null).
         * But as we need to pick up the uom from the Po Lines table (when a template is sourced from a
         * blanket line), we can't have this outer join in the uomtl table.
         * As a hack to eliminate the outer join, we're equating the FPLT Item with a valid UOM , that is
         * retrieved at the start of this procedure for the equi join condition.
         * Here in the select we want to put back the UOM as null for the FPLT Item Prices.
         */
        'DECODE(pltb.order_type_lookup_code, ''FIXED PRICE'', NULL, uomtl.uom_code) unit_of_measure, '||
        --FPJ FPSL Extractor Changes
        'DECODE(prl.source_type_code, ''VENDOR'', '||
        'nvl(decode(gc.minimum_accountable_unit, null, '||
        'round(DECODE(pltb.order_type_lookup_code, ''FIXED PRICE'', '||
        'pl.amount, pl.unit_price)*nvl(ph.rate, 1),gc.extended_precision), '||
        'round(DECODE(pltb.order_type_lookup_code, ''FIXED PRICE'', '||
        'pl.amount, pl.unit_price)*nvl(ph.rate, 1)/gc.minimum_accountable_unit)* '||
        'gc.minimum_accountable_unit), '||
        'DECODE(pltb.order_type_lookup_code, ''FIXED PRICE'', '||
        'prl.amount, prl.unit_price)), NULL) functional_price, '||
        'ph.segment1 contract_num, '||
        'pl.line_num contract_line_num, '||
        'TO_CHAR(NULL) manufacturer, '||
        'TO_CHAR(NULL) manufacturer_part_num, '||
        'ph.rate_type, '||
        'ph.rate_date, '||
        'ph.rate, '||
        'icx_pv.segment1 supplier_number, '||
        'NVL(ph.vendor_contact_id, prl.suggested_vendor_contact_id) supplier_contact_id, '||
        'prl.item_revision, '||
        'prl.line_type_id, '||
        'prl.suggested_buyer_id buyer_id, '||
        'TO_CHAR(NULL) global_agreement_flag, '||
        'ICX_POR_EXT_DIAG.getTemplateLineStatus(prl.express_name, '||
        'prl.sequence_num, prl.org_id, prh.inactive_date, '||
        'prl.po_line_id, '''||ICX_POR_EXT_TEST.gTestMode||''') status ';
Line: 5763

        'greatest(NVL(mi.last_update_date, l.template_lines_last_run_date-1), ' ||
        'prl.last_update_date, prh.last_update_date) > '||
        'l.template_lines_last_run_date OR '||
        'prh.inactive_date BETWEEN l.template_lines_last_run_date AND '||
        'SYSDATE) '||
        'AND prl.express_name = prh.express_name '||

        /*  Bug#3693294 : srmani.   Pick up the UOM from the
         *     - BPA Line (when sourced from a BPA),
         *     - Template Line (otherwise).
         *  To do this we'll have to equate the UOM Code in the Po Lines table with UOMTL
         *  As, there already exists an outer join on Po Lines, we can't have the outer
         *  join on UOMTL (introduced for FPLT Items. ).  To still have this work functionally
         *  without an outerjoin, we're doing an equi-join on Template Line (with line type
         *  as fixed price) and UOMTL using a valid UOM (retrieved earlier in the procedure.
         */

        'AND DECODE(pltb.order_type_lookup_code,  ' ||
        '    ''FIXED PRICE'',  ''' || xOneValidUomCode || ''' , ' ||
        '    NVL(pl.unit_meas_lookup_code, prl.unit_meas_lookup_code) ) = ' ||
        '     uomtl.unit_of_measure ' ||
        'AND uomtl.language = ''' || ICX_POR_EXTRACTOR.gBaseLang || ''' ' ||
        --Bug#2998604 'AND uomtl.source_lang = uomtl.language '||
        'AND (prl.org_id is null and prh.org_id is null or '||
        'prl.org_id = prh.org_id) '||
        'AND prl.po_header_id = ph.po_header_id(+) '||
        'AND prl.po_line_id = pl.po_line_id(+) '||
        'AND (prh.org_id is null and fsp.org_id is null or '||
        'prh.org_id = fsp.org_id) '||
        'AND gsb.set_of_books_id = fsp.set_of_books_id '||
        'AND nvl(ph.currency_code, gsb.currency_code) = gc.currency_code '||
        'AND fsp.inventory_organization_id = NVL(mi.organization_id, '||
        'fsp.inventory_organization_id) '||
        'AND prl.item_id = mi.inventory_item_id (+) '||
        'AND prl.suggested_vendor_id = icx_pv.vendor_id (+) '||
        'AND prl.suggested_vendor_site_id = pvs.vendor_site_id (+) '||
        --FPJ FPSL Extractor Changes
        'AND prl.line_type_id = pltb.line_type_id  '||
        'AND NVL(pltb.purchase_basis, ''NULL'') <> ''TEMP LABOR'' ';
Line: 5805

        'SELECT '||CONTRACT_TYPE||' document_type, '||
        'greatest(pl.last_update_date, ph.last_update_date) '||
        'last_update_date, '||
        'NVL(pl.org_id, '||NULL_NUMBER||') org_id, '||
        'NVL(ph.vendor_id, '||NULL_NUMBER||') supplier_id, '||
        'icx_pv.vendor_name supplier, '||
        '';
Line: 6021

        'greatest(NVL(mi.last_update_date, l.contracts_last_run_date-1), '||
        'pl.last_update_date, ph.last_update_date ';
Line: 6027

          ', icx_psp.last_update_date ';
Line: 6033

        'mck.last_update_date > l.contracts_last_run_date OR ' ||
        'ph.end_date BETWEEN l.contracts_last_run_date AND SYSDATE OR '||
        -- pcreddy # 3122831
        'trunc(ph.start_date) between trunc(l.contracts_last_run_date) and trunc(sysdate) OR '||
        'pl.expiration_date BETWEEN l.contracts_last_run_date AND '||
        'SYSDATE OR '||
        '(ph.type_lookup_code = ''QUOTATION'' AND '||
        'EXISTS (SELECT ''updated quotaion line location'' ';
Line: 6053

        'AND GREATEST(pll.last_update_date, pqa.last_update_date) > '||
        'l.contracts_last_run_date))) '||
        'AND ph.po_header_id = pl.po_header_id '||
        --Bug #4474307
	'AND mck.category_id = pl.category_id ' ||
        --Bug  #4474307 - end
        '';
Line: 6104

        'SELECT /*+ LEADING(pasl) */'||ASL_TYPE||' document_type, '||
        'pasl.last_update_date, '||
        'NVL(fsp.org_id, '||NULL_NUMBER||') org_id, '||
        'NVL(pasl.vendor_id, '||NULL_NUMBER||') supplier_id, '||
        'icx_pv.vendor_name supplier, '||
       'Decode( fsp.org_id, pvs.org_id , pvs.vendor_site_code,TO_CHAR(NULL))  supplier_site_code  ,' ||
        'NVL(pasl.primary_vendor_item, TO_CHAR('||NULL_NUMBER||
        ')) supplier_part_num, '||
        'pasl.item_id internal_item_id, '||
        'mi.concatenated_segments internal_item_num, '||
        'mi.organization_id inventory_organization_id, '||
        'ICX_POR_EXT_ITEM.getItemSourceType(''ASL'', pasl.item_id, ' ||
        'mi.purchasing_enabled_flag, mi.outside_operation_flag, ' ||
        'mi.list_price_per_unit, l.load_item_master, ' ||
        'mi.internal_order_enabled_flag, l.load_internal_item) item_source_type, ' ||
        '''SUPPLIER'' item_search_type, '||
        'NVL(pasl.category_id, mic.category_id) mtl_category_id, '||
        'TO_CHAR(NVL(pasl.category_id, mic.category_id)) category_key, '||
        'mitl.description description, '||
        'TO_CHAR(NULL) picture, '||
        'TO_CHAR(NULL) picture_url, '||
        '''ASL'' price_type,  '||
        'pasl.asl_id, '||
         'Decode( fsp.org_id, pvs.org_id ,pasl.vendor_site_id,'||NULL_NUMBER||')  supplier_site_id  ,' ||
        'TO_NUMBER('||NULL_NUMBER||') contract_id, '||
        'TO_NUMBER('||NULL_NUMBER||') contract_line_id, '||
        'TO_CHAR('||NULL_NUMBER||') template_id, '||
        'TO_NUMBER('||NULL_NUMBER||') template_line_id, '||
        '''SUPPLIER'' price_search_type, '||
        'mi.list_price_per_unit unit_price, '||
        --FPJ FPSL Extractor Changes
        'TO_CHAR(NULL) value_basis, '||
        'TO_CHAR(NULL) purchase_basis, '||
        'TO_CHAR(NULL) allow_price_override_flag, '||
        'TO_NUMBER(NULL) not_to_exceed_price, '||
        -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
        'TO_NUMBER('||NULL_NUMBER||') suggested_quantity, '||
        -- FPJ Bug# 3110297 jingyu    Add negotiated flag
        '''N'' negotiated_by_preparer_flag, ' ||
        'gsb.currency_code currency, '||
        'mi.primary_uom_code unit_of_measure, '||
        'mi.list_price_per_unit functional_price, '||
        'TO_CHAR(NULL) contract_num, '||
        'TO_NUMBER(NULL) contract_line_num, '||
        'TO_CHAR(NULL) manufacturer, '||
        'TO_CHAR(NULL) manufacturer_part_num, '||
        'TO_CHAR(NULL) rate_type, '||
        'TO_DATE(NULL) rate_date, '||
        'TO_NUMBER(NULL) rate, '||
        'TO_CHAR(NULL) supplier_number, '||
        'TO_NUMBER(NULL) supplier_contact_id, '||
        'TO_CHAR(NULL) item_revision, '||
        'TO_NUMBER(NULL) line_type_id, '||
        'TO_NUMBER(NULL) buyer_id, '||
        'TO_CHAR(NULL) global_agreement_flag, '||
        'ICX_POR_EXT_DIAG.getASLStatus(pasl.asl_id, '||
        'pasl.disable_flag, pasl.asl_status_id, '||
        'mi.list_price_per_unit, '''||ICX_POR_EXT_TEST.gTestMode||
        ''') status ';
Line: 6191

        'GREATEST(NVL(mi.last_update_date, l.item_master_last_run_date-1), '||
        'pasl.last_update_date) > l.item_master_last_run_date) '||
        'AND mic.category_set_id = '||gCategorySetId||' '||
        'AND fsp.inventory_organization_id = pasl.owning_organization_id '||
        'AND mic.inventory_item_id = pasl.item_id '||
        'AND mic.organization_id = pasl.owning_organization_id '||
        'AND pasl.item_id = mi.inventory_item_id '||
        'AND pasl.owning_organization_id = mi.organization_id '||
        'AND fsp.set_of_books_id = gsb.set_of_books_id '||
        'AND mi.inventory_item_id = mitl.inventory_item_id '||
        'AND mi.organization_id = mitl.organization_id '||
        'AND mitl.language = '''||ICX_POR_EXTRACTOR.gBaseLang||''' '||
        'AND pasl.vendor_id = icx_pv.vendor_id '||
        'AND pasl.vendor_site_id = pvs.vendor_site_id (+) ';
Line: 6210

        'SELECT /*+ cardinality(type 2) first_rows use_nl(type l fsp) */ type.document_type, '||
        'mi.last_update_date, '||
        'NVL(fsp.org_id, '||NULL_NUMBER||') org_id, '||
        'TO_NUMBER('||NULL_NUMBER||') supplier_id, '||
        'TO_CHAR(NULL) supplier, '||
        'TO_CHAR(NULL) supplier_site_code, '||
        'TO_CHAR('||NULL_NUMBER||') supplier_part_num, '||
        'mi.inventory_item_id internal_item_id, '||
        'mi.concatenated_segments internal_item_num, '||
        'mi.organization_id inventory_organization_id, '||
        'ICX_POR_EXT_ITEM.getItemSourceType(type.price_type, mi.inventory_item_id, ' ||
        'mi.purchasing_enabled_flag, mi.outside_operation_flag, ' ||
        'mi.list_price_per_unit, l.load_item_master, ' ||
        'mi.internal_order_enabled_flag, l.load_internal_item) item_source_type, ' ||
        'ICX_POR_EXT_ITEM.getSearchType(type.price_type, mi.inventory_item_id, ' ||
        'mi.purchasing_enabled_flag, mi.outside_operation_flag, ' ||
        'mi.list_price_per_unit, l.load_item_master, ' ||
        'mi.internal_order_enabled_flag, l.load_internal_item) item_search_type, ' ||
        'mic.category_id mtl_category_id, '||
        'TO_CHAR(mic.category_id) category_key, '||
        'TO_CHAR(NULL) description, '||
        'TO_CHAR(NULL) picture, '||
        'TO_CHAR(NULL) picture_url, '||
        'type.price_type,  '||
        'TO_NUMBER('||NULL_NUMBER||') asl_id, '||
        'TO_NUMBER('||NULL_NUMBER||') supplier_site_id, '||
        'TO_NUMBER('||NULL_NUMBER||') contract_id, '||
        'TO_NUMBER('||NULL_NUMBER||') contract_line_id, '||
        'TO_CHAR('||NULL_NUMBER||') template_id, '||
        'TO_NUMBER('||NULL_NUMBER||') template_line_id, '||
        'type.price_search_type, '||
        'DECODE(type.document_type, '||PURCHASING_ITEM_TYPE||', '||
        'mi.list_price_per_unit, NULL) unit_price, '||
        --FPJ FPSL Extractor Changes
        'TO_CHAR(NULL) value_basis, '||
        'TO_CHAR(NULL) purchase_basis, '||
        'TO_CHAR(NULL) allow_price_override_flag, '||
        'TO_NUMBER(NULL) not_to_exceed_price, '||
        -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
        'TO_NUMBER('||NULL_NUMBER||') suggested_quantity, '||
        -- FPJ Bug# 3110297 jingyu    Add negotiated flag
        '''N'' negotiated_by_preparer_flag, ' ||
        'DECODE(type.document_type, '||PURCHASING_ITEM_TYPE||', '||
        'gsb.currency_code, NULL) currency, '||
        'DECODE(type.document_type, '||PURCHASING_ITEM_TYPE||', '||
        'mi.primary_uom_code, '||
        'NVL(muom.uom_code, mi.primary_uom_code)) unit_of_measure, '||
        'DECODE(type.document_type, '||PURCHASING_ITEM_TYPE||', '||
        'mi.list_price_per_unit, NULL) functional_price, '||
        'TO_CHAR(NULL) contract_num, '||
        'TO_NUMBER(NULL) contract_line_num, '||
        'TO_CHAR(NULL) manufacturer, '||
        'TO_CHAR(NULL) manufacturer_part_num, '||
        'TO_CHAR(NULL) rate_type, '||
        'TO_DATE(NULL) rate_date, '||
        'TO_NUMBER(NULL) rate, '||
        'TO_CHAR(NULL) supplier_number, '||
        'TO_NUMBER(NULL) supplier_contact_id, '||
        'TO_CHAR(NULL) item_revision, '||
        'TO_NUMBER(NULL) line_type_id, '||
        'TO_NUMBER(NULL) buyer_id, '||
        'TO_CHAR(NULL) global_agreement_flag, '||
        'DECODE(type.document_type, '||PURCHASING_ITEM_TYPE||', '||
        'ICX_POR_EXT_DIAG.getPurchasingItemStatus(mi.purchasing_enabled_flag, '||
        'mi.outside_operation_flag, '||
        'mi.list_price_per_unit, '''||ICX_POR_EXT_TEST.gTestMode||'''),  '||
        'ICX_POR_EXT_DIAG.getInternalItemStatus(mi.internal_order_enabled_flag, '''||
        ICX_POR_EXT_TEST.gTestMode||''')) status ';
Line: 6297

        '(SELECT '||PURCHASING_ITEM_TYPE||' document_type, '||
        '''PURCHASING_ITEM'' price_type, '||
        '''SUPPLIER'' price_search_type '||
        'FROM dual '||
        'UNION ALL '||
        'SELECT '||INTERNAL_ITEM_TYPE||' document_type, '||
        '''INTERNAL_ITEM'' price_type, '||
        '''INTERNAL'' price_search_type '||
        'FROM dual) type '||
        -- Bug#3213218/3163334 : pcreddy - Check for the load flag to be 'Y'.
        'WHERE ( (l.load_item_master = ''Y'' AND ' ||
        '         l.item_master_last_run_date IS NULL) OR ' ||
        '        (l.load_internal_item = ''Y'' AND ' ||
        '         l.internal_item_last_run_date IS NULL)  OR ' ||
        -- 'WHERE (l.item_master_last_run_date IS NULL OR  '||
        -- 'l.internal_item_last_run_date IS NULL OR '||
        -- Bug # 3529303
        'mi.last_update_date > LEAST(nvl(l.item_master_last_run_date, '||
        'sysdate), nvl(l.internal_item_last_run_date, sysdate)) OR '||
        'EXISTS (SELECT ''updated description'' ';
Line: 6327

        'AND mitl.last_update_date > GREATEST(l.item_master_last_run_date, '||
        'l.internal_item_last_run_date)) OR '||
        'mic.last_update_date > GREATEST(l.item_master_last_run_date, '||
        'l.internal_item_last_run_date) OR '||
        'mc.last_update_date > GREATEST(l.item_master_last_run_date, '||
        'l.internal_item_last_run_date)) '||
        'AND mi.inventory_item_id = mic.inventory_item_id '||
        'AND mic.organization_id = mi.organization_id '||
        'AND mic.category_id = mc.category_id '||
        'AND mic.category_set_id = '||gCategorySetId||' '||
        'AND mc.web_status = ''Y'' '||
        'AND NOT (mi.replenish_to_order_flag = ''Y'' AND '||
        'mi.base_item_id IS NOT NULL AND '||
        'mi.auto_created_config_flag = ''Y'') '||
        'AND mi.unit_of_issue = muom.unit_of_measure(+) '||
        'AND muom.language(+) = '''||ICX_POR_EXTRACTOR.gBaseLang||''' '||
        'AND mi.organization_id = fsp.inventory_organization_id '||
        'AND fsp.set_of_books_id = gsb.set_of_books_id ';
Line: 6418

    pSqlString := xSelectStr||
      'FROM ('||xViewStr||xViewStr2||') doc, '||
      xFromStr||xWhereStr;
Line: 6431

    xSelectStr :=
      'SELECT /*+ LEADING(doc) */ '||
      GLOBAL_AGREEMENT_TYPE||' document_type, '||
      'doc.last_update_date, '||
      'doc.org_id, '||
      'doc.supplier_id, '||
      'doc.supplier, '||
      'doc.supplier_site_code, '||
      'doc.supplier_part_num, '||
      'doc.internal_item_id, '||
      'doc.internal_item_num, '||
      'doc.inventory_organization_id, '||
      'TO_CHAR(NULL) item_source_type, '||
      'TO_CHAR(NULL) item_search_type, '||
      'doc.mtl_category_id, '||
      'TO_CHAR(NULL) category_key, '||
      'TO_CHAR(NULL) description, '||
      'TO_CHAR(NULL) picture, '||
      'TO_CHAR(NULL) picture_url, '||
      '''GLOBAL_AGREEMENT'' price_type, '||
      'TO_NUMBER(-2) asl_id, '||
      'doc.supplier_site_id, '||
      'doc.contract_id, '||
      'doc.contract_line_id, '||
      'TO_CHAR(-2) template_id,  '||
      'TO_NUMBER(-2) template_line_id, '||
      '''SUPPLIER'' price_search_type, '||
      'doc.unit_price, '||
      'doc.value_basis, '||
      'doc.purchase_basis,  '||
      'doc.allow_price_override_flag, '||
      'doc.not_to_exceed_price, '||
      'TO_NUMBER(-2) suggested_quantity, '||
      'doc.negotiated_by_preparer_flag, '||
      'doc.currency, '||
      'doc.unit_of_measure, '||
      'doc.functional_price, '||
      'doc.contract_num, '||
      'doc.contract_line_num, '||
      'TO_CHAR(NULL) manufacturer, '||
      'TO_CHAR(NULL) manufacturer_part_num, '||
      'doc.rate_type, '||
      'doc.rate_date, '||
      'doc.rate, '||
      'TO_CHAR(NULL) supplier_number, '||
      'TO_NUMBER(NULL) supplier_contact_id, '||
      'TO_CHAR(NULL) item_revision, '||
      'doc.line_type_id, '||
      'TO_NUMBER(NULL) buyer_id, '||
      '''N'' global_agreement_flag, '||
      'doc.status, '||
      'TO_NUMBER(NULL) primary_category_id, '||
      'TO_CHAR(NULL) primary_category_name, '||
      'TO_NUMBER(NULL) template_category_id, '||
      'doc.price_rt_item_id, '||
      'TO_NUMBER(NULL) price_internal_item_id, '||
      'TO_NUMBER(NULL) price_supplier_id, '||
      'TO_CHAR(NULL) price_supplier_part_num, '||
      'TO_NUMBER(NULL) price_contract_line_id, '||
      'TO_NUMBER(NULL) price_mtl_category_id, '||
      'TO_NUMBER(NULL) match_primary_category_id, '||
      'TO_NUMBER(NULL) rt_item_id, '||
      'TO_NUMBER(NULL) local_rt_item_id, '||
      '''N'' match_template_flag, '||
      'p.active_flag active_flag, '||
      'ROWIDTOCHAR(p.rowid) price_rowid ';
Line: 6499

         'SELECT /*+ LEADING(t) */ '||
         't.po_header_id as PoHeaderId, '||
         't.organization_id as OrganizationId, '||
         'ip.contract_line_id as ContractLineId, '||
         't.last_update_date, '||
         'NVL(t.organization_id, '||NULL_NUMBER||') org_id, '||
         'NVL(i.supplier_id, '||NULL_NUMBER||') supplier_id, '||
         'NVL(i.supplier, TO_CHAR('||NULL_NUMBER||')) supplier, '||
         'pvs.vendor_site_code supplier_site_code, '||
         'NVL(i.supplier_part_num, TO_CHAR('||NULL_NUMBER||
         ')) supplier_part_num, '||
         'NVL(i.internal_item_id, '||NULL_NUMBER||') internal_item_id, '||
         'i.internal_item_num, '||
         'mi.organization_id inventory_organization_id, '||
         'ip.mtl_category_id, '||
         't.vendor_site_id supplier_site_id, '||
         't.po_header_id contract_id, '||
         'ip.contract_line_id, '||
         'ip.unit_price, '||
         --FPJ FPSL Extractor Changes
         'ip.value_basis, '||
         'ip.purchase_basis, '||
         'ip.allow_price_override_flag, '||
         'ip.not_to_exceed_price, '||
         -- FPJ Bug# 3110297 jingyu    Add negotiated flag
         'ip.negotiated_by_preparer_flag negotiated_by_preparer_flag, '||
         'ip.currency, '||
         'ip.unit_of_measure, '||
         'ICX_CAT_UTIL_PKG.convert_amount_sql(ip.currency, '||
         'gsb.currency_code, SYSDATE, icx_psp.default_rate_type, '||
         'ip.unit_price) functional_price, '||
         'ip.contract_num, '||
         'ip.contract_line_num, '||
         /* Retrieve and use the Default Rate Type form the Purchasing Options of the
          * Enabled Org for calculation of Rate and Functional Price.
          */
         'icx_psp.default_rate_type rate_type, '||
         'sysdate rate_date, '||
         'ICX_POR_EXT_ITEM.getRate(fsp.set_of_books_id, '||
                                              'ip.currency, '||
                                              'sysdate, '||
                                              'icx_psp.default_rate_type, ' ||
                                              't.purchasing_org_id, '||
                                              'ip.org_id, '||
                                              'ip.contract_num ) rate, '||
         -- bug 2912717: populate line_type, rate info. for GA
         'ip.line_type_id line_type_id, '||
         'ICX_POR_EXT_DIAG.getGlobalAgreementStatus(t.enabled_flag, '||
         'pvs.purchasing_site_flag, '||
         'pvs.inactive_date, '||
         'mi.purchasing_enabled_flag, '||
         'mi.outside_operation_flag, '||
         'mi.primary_uom_code, '||
         'mi2.purchasing_enabled_flag, '||
         'mi2.outside_operation_flag, '||
         'ip.unit_of_measure, '||
         'mi2.primary_uom_code, '''||
         ICX_POR_EXT_TEST.gTestMode||''') status, '||
         'ip.rt_item_id price_rt_item_id ';
Line: 6591

         'GREATEST(NVL(mi.last_update_date, l.contracts_last_run_date-1), '||
         'ip.creation_date, t.last_update_date) > l.contracts_last_run_date) '||
         'AND t.vendor_site_id = pvs.vendor_site_id (+) '||
         'AND icx_psp.org_id = t.organization_id '||
         'AND ip.contract_id = t.po_header_id '||
         'AND ip.price_type = ''BLANKET'' '||
         'AND t.organization_id <> ip.org_id '||
         'AND t.purchasing_org_id = fsp2.org_id '||  -- Centralized Proc Impacts Enhancement
         'AND i.rt_item_id = ip.rt_item_id '||
         'AND t.organization_id = fsp.org_id '||
         'AND fsp.set_of_books_id = gsb.set_of_books_id '||
         'AND ip.inventory_item_id = mi.inventory_item_id (+) '||
         'AND ip.inventory_item_id = mi2.inventory_item_id (+) '|| -- Centralized Proc Impacts
         'AND fsp.inventory_organization_id = NVL(mi.organization_id, '||
         'fsp.inventory_organization_id) '||
         'AND fsp2.inventory_organization_id = NVL(mi2.organization_id, '|| -- Centralized Proc Impacts
         'fsp2.inventory_organization_id) ';
Line: 6640

      'SELECT /*+ LEADING(g) */ '||GLOBAL_AGREEMENT_TYPE||' document_type, '||
      'p.last_update_date, '||
      'NVL(p.org_id, '||NULL_NUMBER||') org_id, '||
      'NVL(i.supplier_id, '||NULL_NUMBER||') supplier_id, '||
      'NVL(i.supplier, TO_CHAR('||NULL_NUMBER||')) supplier, '||
      'TO_CHAR(NULL) supplier_site_code, '||
      'NVL(i.supplier_part_num, TO_CHAR('||NULL_NUMBER||
      ')) supplier_part_num, '||
      'NVL(i.internal_item_id, '||NULL_NUMBER||') internal_item_id, '||
      'i.internal_item_num, '||
      'TO_NUMBER(NULL) inventory_organization_id, '||
      'TO_CHAR(NULL) item_source_type, '||
      'TO_CHAR(NULL) item_search_type, '||
      'TO_NUMBER(NULL) mtl_category_id, '||
      'TO_CHAR(NULL) category_key, '||
      'TO_CHAR(NULL) description, '||
      'TO_CHAR(NULL) picture, '||
      'TO_CHAR(NULL) picture_url, '||
      '''SET_ACTIVE_FLAG'' price_type,  '||
      'TO_NUMBER(NULL) asl_id, '||
      'TO_NUMBER(NULL) supplier_site_id, '||
      'TO_NUMBER(NULL) contract_id, '||
      'p.contract_line_id, '||
      'TO_CHAR(NULL) template_id, '||
      'TO_NUMBER(NULL) template_line_id, '||
      'TO_CHAR(NULL) price_search_type, '||
      'TO_NUMBER(NULL) unit_price, '||
      --FPJ FPSL Extractor Changes
      'TO_CHAR(NULL) value_basis, '||
      'TO_CHAR(NULL) purchase_basis, '||
      'TO_CHAR(NULL) allow_price_override_flag, '||
      'TO_NUMBER(NULL) not_to_exceed_price, '||
      -- FPJ Bug# 3007068 sosingha: Extractor Changes For Kit Support Project
      'TO_NUMBER(NULL) suggested_quantity, '||
      -- FPJ Bug# 3110297 jingyu    Add negotiated flag
      'TO_CHAR(NULL) negotiated_by_preparer_flag, '||
      'TO_CHAR(NULL) currency, '||
      'TO_CHAR(NULL) unit_of_measure, '||
      'TO_NUMBER(NULL) functional_price, '||
      'TO_CHAR(NULL) contract_num, '||
      'TO_NUMBER(NULL) contract_line_num, '||
      'TO_CHAR(NULL) manufacturer, '||
      'TO_CHAR(NULL) manufacturer_part_num, '||
      'TO_CHAR(NULL) rate_type, '||
      'TO_DATE(NULL) rate_date, '||
      'TO_NUMBER(NULL) rate, '||
      'TO_CHAR(NULL) supplier_number, '||
      'TO_NUMBER(NULL) supplier_contact_id, '||
      'TO_CHAR(NULL) item_revision, '||
      'TO_NUMBER(NULL) line_type_id, '||
      'TO_NUMBER(NULL) buyer_id, '||
      'TO_CHAR(NULL) global_agreement_flag, '||
      ICX_POR_EXT_DIAG.VALID_FOR_EXTRACT||' status, '||
      'TO_NUMBER(NULL) primary_category_id, '||
      'TO_CHAR(NULL) primary_category_name, '||
      'TO_NUMBER(NULL) template_category_id, '||
      'TO_NUMBER(NULL) price_rt_item_id, '||
      'TO_NUMBER(NULL) price_internal_item_id, '||
      'TO_NUMBER(NULL) price_supplier_id, '||
      'TO_CHAR(NULL) price_supplier_part_num, '||
      'TO_NUMBER(NULL) price_contract_line_id, '||
      'TO_NUMBER(NULL) price_mtl_category_id, '||
      'TO_NUMBER(NULL) match_primary_category_id, '||
      'TO_NUMBER(NULL) rt_item_id, '||
      'p.local_rt_item_id, '||
      'TO_CHAR(NULL) match_template_flag, '||
      'TO_CHAR(NULL) active_flag, '||
      'ROWIDTOCHAR(p.rowid) price_rowid '||
      'FROM icx_cat_item_prices p, '||
      'icx_cat_extract_ga_gt g, '||
      'icx_cat_items_b i '||
      'WHERE p.contract_id = g.contract_id '||
      'AND p.contract_line_id = g.contract_line_id '||
      'AND p.price_type = ''GLOBAL_AGREEMENT'' '||
      'AND i.rt_item_id = p.rt_item_id ';
Line: 6728

      xSelectStr ||
      'FROM ( '|| xViewStr || xViewStr2 || ') doc, '||
      xFromStr || xWhereStr ||
      ' UNION ALL ' || xString;
Line: 6766

  cUpdatedVendorNames   tCursorType;
Line: 6773

  cUpdatedVendorSites   tCursorType;
Line: 6794

    'SELECT /*+ LEADING(v) */  v.vendor_id, '||
    'v.vendor_name ';
Line: 6806

    'v.last_update_date > l.vendor_last_run_date) ' ||
    'AND NOT EXISTS (SELECT ''updated vendor name'' ' ||
    'FROM icx_cat_items_b i ' ||
    'WHERE i.supplier_id = v.vendor_id ' ||
    'AND i.supplier = v.vendor_name)';
Line: 6815

      'Query for updated vendor names: ' || xString);
Line: 6818

  OPEN cUpdatedVendorNames FOR xString;
Line: 6820

  /* Changing the fetch for cUpdatedVendorNames to bulk fetch into plsql tables
     and moving the fetch outside of the loop for the following reasons:
     1. Dont expect a huge number of vendor_names that needs changes in catalog items table
        Even if there are huge number of vendor_names that will be returned by the cursor cUpdatedVendorNames
        doing a bulk fetch will only increase the size of plsql tables
     2. We can take the advantage of doing bulk fetch for cUpdatedVendorNames
     3. While updating icx_cat_items_tlp we can utilize forall instead of processing one vendor at a time
        anyway we will be processing only 2500 rows at a time, since we have the rownum constraint.
  */
  xErrLoc := 160;
Line: 6833

        FETCH cUpdatedVendorNames INTO xVendorId(xIndex), xVendorName(xIndex);
Line: 6834

        EXIT WHEN cUpdatedVendorNames%NOTFOUND;
Line: 6839

      FETCH cUpdatedVendorNames BULK COLLECT
      INTO  xVendorId, xVendorName;
Line: 6865

      xRtItemIds.DELETE;
Line: 6866

      xNewVendorNames.DELETE;
Line: 6870

      UPDATE icx_cat_items_b
      SET    supplier = xVendorName(i),
             last_updated_by = ICX_POR_EXTRACTOR.gUserId,
             last_update_date = SYSDATE,
             last_update_login = ICX_POR_EXTRACTOR.gLoginId,
             request_id = ICX_POR_EXTRACTOR.gRequestId,
             program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
             program_id = ICX_POR_EXTRACTOR.gProgramId,
             program_update_date = SYSDATE
      WHERE  supplier_id = xVendorId(i)
      AND    supplier <> xVendorName(i)
      AND    rownum <= xCommitSize
      RETURNING RT_ITEM_ID, SUPPLIER BULK COLLECT INTO xRtItemIds, xNewVendorNames;
Line: 6896

        UPDATE icx_cat_items_tlp
        SET    supplier = xNewVendorNames(i),
               last_updated_by = ICX_POR_EXTRACTOR.gUserId,
               last_update_date = SYSDATE,
               last_update_login = ICX_POR_EXTRACTOR.gLoginId,
               request_id = ICX_POR_EXTRACTOR.gRequestId,
               program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
               program_id = ICX_POR_EXTRACTOR.gProgramId,
               program_update_date = SYSDATE
        WHERE  rt_item_id = xRtItemIds(i);
Line: 6915

  IF (cUpdatedVendorNames%ISOPEN) THEN
    xErrLoc := 410;
Line: 6917

    CLOSE cUpdatedVendorNames;
Line: 6935

    'SELECT /*+ LEADING(vs) */     ' ||
    '           vs.vendor_site_id,     ' ||
    '           vs.vendor_site_code    ';
Line: 6948

    '             vs.last_update_date > l.vendor_last_run_date) ' ||
    '     AND EXISTS ( SELECT ''Updated VendorSite In Catalog''  ' ||
    '                  FROM   icx_cat_item_prices ip ' ||
    '                  WHERE  ip.supplier_site_id = vs.vendor_site_id )';
Line: 6957

      'Query for updated vendor site names: ' || xString);
Line: 6961

  OPEN cUpdatedVendorSites FOR xString;
Line: 6966

        FETCH cUpdatedVendorSites INTO xVendorSiteIds(xIndex), xVendorSiteNames(xIndex);
Line: 6967

        EXIT WHEN cUpdatedVendorSites%NOTFOUND;
Line: 6972

      FETCH cUpdatedVendorSites BULK COLLECT
      INTO  xVendorSiteIds, xVendorSiteNames;
Line: 6999

      UPDATE icx_cat_item_prices
      SET    supplier_site_code = xVendorSiteNames(i),
             last_updated_by = ICX_POR_EXTRACTOR.gUserId,
             last_update_date = SYSDATE,
             last_update_login = ICX_POR_EXTRACTOR.gLoginId,
             request_id = ICX_POR_EXTRACTOR.gRequestId,
             program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
             program_id = ICX_POR_EXTRACTOR.gProgramId,
             program_update_date = SYSDATE
      WHERE  supplier_site_id = xVendorSiteIds(i)
        AND  supplier_site_code <> xVendorSiteNames(i)
        AND  rownum <= xCommitSize;
Line: 7028

  IF (cUpdatedVendorSites%ISOPEN) THEN
    xErrLoc := 680;
Line: 7030

    CLOSE cUpdatedVendorSites;
Line: 7041

    IF (cUpdatedVendorNames%ISOPEN) THEN
      CLOSE cUpdatedVendorNames;
Line: 7090

    SELECT i.rt_item_id
    FROM   icx_cat_extract_gt i
    WHERE  i.type = 'CLEANUP_ITEM'
    AND    NOT EXISTS (SELECT 'price rows'
                       FROM   icx_cat_item_prices p
                       WHERE  p.rt_item_id = i.rt_item_id);
Line: 7107

  xActionMode := 'DELETE_ITEM_NOPRICE';
Line: 7131

    ICX_POR_DELETE_CATALOG.setCommitSize(ICX_POR_EXT_UTL.gCommitSize);
Line: 7134

    ICX_POR_DELETE_CATALOG.deleteCommonTables(gDIRtItemIds,
      ICX_POR_DELETE_CATALOG.ITEM_TABLE_LAST);
Line: 7147

    'Total deleted items without price : ' || xRowCount);
Line: 7184

    SELECT p.price_type,
           p.rt_item_id,
                p.rowid price_rowid,
                ICX_POR_EXT_ITEM.getActiveFlag(p.price_type, p.rowid) active_flag
    FROM   icx_cat_item_prices p,
           icx_cat_extract_gt i
    WHERE  i.type = 'ACTIVE_FLAG'
      AND  p.rt_item_id = i.rt_item_id
      AND  p.price_type <> 'GLOBAL_AGREEMENT'
      AND  nvl(p.request_id, ICX_POR_EXT_ITEM.AF_NEW_PRICE_TEMP_REQUEST_ID) <>
             ICX_POR_EXT_ITEM.AF_CURRENT_REQUEST_ID; -- Bug # 3542291
Line: 7234

      UPDATE icx_cat_item_prices
      SET    active_flag = gSAActiveFlags(i),
                  last_updated_by = ICX_POR_EXTRACTOR.gUserId,
                  last_update_date = SYSDATE,
                  last_update_login = ICX_POR_EXTRACTOR.gLoginId,
             -- Bug # 3542291
             request_id = ICX_POR_EXT_ITEM.AF_CURRENT_REQUEST_ID,
                  program_application_id = ICX_POR_EXTRACTOR.gProgramApplicationId,
                  program_id = ICX_POR_EXTRACTOR.gProgramId,
                  program_update_date = SYSDATE
      WHERE  rowid = gSARowIds(i);
Line: 7387

  xActionMode := 'DELETE_ITEM_PRICE';
Line: 7391

    'SELECT p.rowid, '||
    'p.rt_item_id, '||
    'ic.rt_category_id template_category_id, '||
    'p.inventory_item_id, '||
    'p.org_id, '||
    'p.local_rt_item_id '||
    'FROM icx_cat_item_prices p, '||
    'icx_cat_categories_tl ic '||
    'WHERE p.price_type IN (''TEMPLATE'', ''INTERNAL_TEMPLATE'', ' ||
    ' ''BLANKET'', ''QUOTATION'', ''GLOBAL_AGREEMENT'', ''ASL'', ' ||
    ' ''PURCHASING_ITEM'', ''INTERNAL_ITEM'') ' ||
    'AND ICX_POR_EXT_DIAG.getPriceStatus(p.price_type, p.rowid, '''||
    ICX_POR_EXT_TEST.gTestMode||''') <> '||
    ICX_POR_EXT_DIAG.VALID_FOR_EXTRACT||' '||
    'AND p.template_id||''_tmpl'' = ic.key (+) '||
    'AND ic.type (+) = '||ICX_POR_EXT_CLASS.TEMPLATE_HEADER_TYPE||' '||
    'AND ic.language (+) = '''||ICX_POR_EXTRACTOR.gBaseLang||''' ';
Line: 7410

      'AND p.last_updated_by = '||ICX_POR_EXT_TEST.TEST_USER_ID||' ';
Line: 7457

      DELETE icx_cat_item_prices
      WHERE  rowid = gDPRowIds(i);
Line: 7462

      DELETE icx_cat_category_items
      WHERE  rt_category_id = gDPTemplateCategoryIds(i)
      AND    rt_item_id = gDPRtItemIds(i);
Line: 7469

      INSERT INTO icx_cat_extract_gt
      (rt_item_id, type)
      VALUES (gDPRtItemIds(i), 'CLEANUP_ITEM');
Line: 7475

      INSERT INTO icx_cat_extract_gt
      (rt_item_id, type)
      VALUES (gDPRtItemIds(i), 'ACTIVE_FLAG');
Line: 7480

      INSERT INTO icx_cat_extract_gt
      (rt_item_id, type)
      SELECT rt_item_id, 'ACTIVE_FLAG'
      FROM   icx_cat_items_b
      WHERE  internal_item_id = gDPInventoryItemIds(i)
      AND    org_id = NVL(gDPOrgIds(i), org_id)
      AND    supplier IS NULL;
Line: 7491

      INSERT INTO icx_cat_extract_gt
      (rt_item_id, type)
      SELECT gDPLocalRtItemIds(i), 'ACTIVE_FLAG'
      FROM   dual
      WHERE  gDPLocalRtItemIds(i) IS NOT NULL;
Line: 7509

    'Total deleted invalid price rows : ' || xRowCount);
Line: 7556

  select category_set_id,
         validate_flag,
         structure_id
  into   gCategorySetId,
         gValidateFlag,
         gStructureId
  from   mtl_default_sets_view
  where  functional_area_id = 2;
Line: 7568

  select nvl(multi_org_flag, 'N')
  into   gMultiOrgFlag
  from   fnd_product_groups;
Line: 7610

    'All updated price rows processing done: ' || gTotalCount);
Line: 7616

  updatePriceRequestIds;
Line: 7623

    updatePriceRequestIds;
Line: 7632

PROCEDURE updatePriceRequestIds IS
  xErrLoc      PLS_INTEGER := 100;
Line: 7637

  UPDATE ICX_CAT_ITEM_PRICES
  SET    REQUEST_ID = ICX_POR_EXTRACTOR.gRequestId
  WHERE  REQUEST_ID IN (
                 TEMPLATE_TEMP_REQUEST_ID,
                 CONTRACT_TEMP_REQUEST_ID,
                 GA_TEMP_REQUEST_ID,
                 ASL_TEMP_REQUEST_ID,
                 ITEM_TEMP_REQUEST_ID,
                 -- Bug # 3542291
                 AF_TEMPLATE_TEMP_REQUEST_ID,
                 AF_CONTRACT_TEMP_REQUEST_ID,
                 AF_GA_TEMP_REQUEST_ID,
                 AF_ASL_TEMP_REQUEST_ID,
                 AF_ITEM_TEMP_REQUEST_ID,
                 AF_CLEANUP_TEMP_REQUEST_ID);
Line: 7659

    ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_ITEM.updatePriceRequestIds -'||
      xErrLoc||' '||SQLERRM);
Line: 7663

END updatePriceRequestIds;