DBA Data[Home] [Help]

APPS.MRP_SOURCING_API_PK SQL Statements

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

Line: 21

    SELECT  stock_enabled_flag, restrict_subinventories_code
    INTO    var_stk,
            var_restrict
    FROM    mtl_system_items
    WHERE   organization_id = arg_org_id
    AND     inventory_item_id = arg_item_id;
Line: 36

            SELECT  'Y'
            into    var_stk
            FROM    mtl_item_sub_inventories
            WHERE   organization_id = arg_org_id
            AND     inventory_item_id = arg_item_id
            AND     secondary_inventory = arg_sub_inv;
Line: 81

            SELECT  misl.vendor_id,
                    misl.vendor_site_id,
                    misl.source_organization_id,
                    misl.allocation_percent,
                    NVL(misl.rank, 9999),
                    misl.sourcing_rule_id
            FROM    mrp_item_sourcing_levels_v misl
            WHERE   misl.source_type in (1,3)
            and     misl.inventory_item_id = arg_item_id
            and     misl.organization_id = arg_dest_organization_id
            and     misl.assignment_set_id = var_set_id
            and     arg_autosource_date between misl.effective_date and
                    NVL(disable_date, to_date(2634525, 'J'))
            and     PO_ASL_SV.check_asl_action('2_SOURCING',
                    misl.vendor_id, misl.vendor_site_id, arg_item_id, -1
		      , arg_dest_organization_id ) <> 0
	    AND  nvl(nvl(p_source_organization_id,
			  	     misl.source_organization_id), -23453)
                 	= nvl(misl.source_organization_id, -23453)
            ORDER BY misl.sourcing_level ASC,
                    allocation_percent DESC, NVL(misl.rank, 9999) ASC;
Line: 126

                select  misi.source_organization_id,
                        misi.source_subinventory
                into    var_source_org,
                        var_source_sub
                from    mtl_item_sub_inventories misi,
                        org_organization_definitions ood,
                        financials_system_parameters fsp
                where   misi.organization_id = arg_dest_organization_id
                and     misi.inventory_item_id = arg_item_id
                and     misi.secondary_inventory = arg_dest_subinventory
		and     misi.organization_id = ood.organization_id
		and     ood.set_of_books_id = fsp.set_of_books_id
		and     ood.operating_unit = fsp.org_id -- bug 4968383
		AND     Nvl(arg_source_organization_id,
			  misi.source_organization_id) = misi.source_organization_id;
Line: 172

                select  msi.source_organization_id,
                        msi.source_subinventory
                into    var_source_org,
                        var_source_sub
                from    mtl_secondary_inventories msi,
                        org_organization_definitions ood,
                        financials_system_parameters fsp
                where   msi.organization_id = arg_dest_organization_id
                and     msi.secondary_inventory_name = arg_dest_subinventory
                and     msi.organization_id = ood.organization_id
		and     ood.set_of_books_id = fsp.set_of_books_id
		and     ood.operating_unit = fsp.org_id -- bug 4968383
		AND     Nvl(arg_source_organization_id,
			  msi.source_organization_id) = msi.source_organization_id;
Line: 220

        SELECT msi.source_organization_id,
               msi.source_subinventory
                 INTO   var_source_org,
                        var_source_sub
                 FROM   mtl_system_items msi,
                        org_organization_definitions ood,
                        financials_system_parameters fsp
                 WHERE  msi.organization_id = arg_dest_organization_id
                 AND    msi.inventory_item_id  = arg_item_id
                 AND    msi.organization_id = ood.organization_id
                 AND    ood.operating_unit = fsp.org_id -- bug 4968383
                 AND    ood.set_of_books_id = fsp.set_of_books_id;
Line: 266

              SELECT mp.source_organization_id,
                     mp.source_subinventory
              INTO   var_source_org,
                     var_source_sub
              FROM   mtl_parameters mp,
                     org_organization_definitions ood,
                     financials_system_parameters fsp
              WHERE  mp.organization_id  = arg_dest_organization_id
              AND    mp.organization_id = ood.organization_id
              AND    ood.operating_unit = fsp.org_id -- bug 4968383
              AND    ood.set_of_books_id = fsp.set_of_books_id;
Line: 336

                SELECT  site.vendor_site_code
                INTO    var_new_site_code
                FROM
                        po_vendor_sites_all site,
                        po_vendors ven
                WHERE   NVL(ven.enabled_flag, 'N') = 'Y'
                AND     SYSDATE BETWEEN NVL(ven.start_date_active, SYSDATE -1)
                AND     NVL(ven.end_date_active, sysdate+1)
                AND     SYSDATE < NVL(site.inactive_date, SYSDATE + 1)
                AND     ven.vendor_id = site.vendor_id(+)
                AND     site.vendor_site_id(+)  = var_site_id
                AND     ven.vendor_id  = var_vendor_id ;
Line: 393

                fnd_message.set_name('MRP', 'GEN-CANNOT SELECT');
Line: 394

                fnd_message.set_token('SELECT', 'EC_SOURCE', TRUE);
Line: 401

                    fnd_message.set_name('MRP', 'GEN-NO ROWS SELECTED');
Line: 439

                select  dest_site.vendor_site_id
                into    arg_vendor_site_id
                FROM    org_organization_definitions  oog,
                        po_vendor_sites_all dest_site,
                        po_vendors ven
                WHERE   NVL(ven.enabled_flag, 'N') = 'Y'
                AND     sysdate BETWEEN NVL(ven.start_date_active, sysdate -1)
                AND     NVL(ven.end_date_active, sysdate+1)
                AND     ven.vendor_id  = arg_vendor_id
                AND     dest_site.vendor_id(+) = ven.vendor_id
                AND     dest_site.vendor_site_code(+) = var_vendor_site_code
                AND     nvl(dest_site.org_id,nvl(oog.operating_unit,-1)) =
                                                      nvl(oog.operating_unit,-1)
                AND     oog.organization_id = arg_dest_organization_id;
Line: 464

                    fnd_message.set_name('MRP', 'GEN-NO ROWS SELECTED');
Line: 490

  SELECT distinct misl.sourcing_rule_name, ml.meaning
  FROM
  mfg_lookups ml,
  mrp_item_sourcing_levels_v misl
  WHERE misl.inventory_item_id = NVL(arg_item_id, misl.inventory_item_id)
  and NVL(misl.category_id,-1) = NVL(arg_category_id, NVL(misl.category_id, -1))
  and misl.vendor_id = arg_supplier_id
  and NVL(misl.vendor_site_id,-1) = NVL(arg_supplier_site_id,-1)
  and sysdate < NVL(misl.disable_date, sysdate + 1)
  and ml.lookup_type = 'MRP_ASSIGNMENT_TYPE'
  and ml.lookup_code = misl.assignment_type;
Line: 560

   select to_date(arg_start_date,'J') - sysdate
     into greater_than_plan_date
     from dual;
Line: 595

    select NVL(sum(PRIMARY_QUANTITY),0)
	into  x_total_alloc_qty
	from mtl_material_transactions
	where
	inventory_item_id = arg_item_id
	and ORGANIZATION_ID = arg_org_id
	and transaction_action_id in (30, 31, 32 )
	/* WIP scrap, Assembly compl , Assy Return qty is -ve */
	and transaction_date between to_date(arg_start_date,'J')
	and decode(arg_end_date,NULL_VALUE,transaction_date, to_date(arg_end_date,'J'));
Line: 636

    delete from mrp_sourcing_history msh
	where
	msh.inventory_item_id = arg_item_id
	and msh.organization_id = arg_org_id
	and msh.sourcing_rule_id = arg_sourcing_rule_id
	and NVL(msh.source_org_id,-1) = decode(arg_source_org, NULL_VALUE, NVL(msh.source_org_id,-1), arg_source_org)
	and NVL(msh.vendor_id,-1) = decode(arg_vendor_id, NULL_VALUE, NVL(msh.vendor_id,-1), arg_vendor_id)
	and NVL(msh.vendor_site_id,-1) = decode(arg_vendor_site_id, NULL_VALUE, NVL(msh.vendor_site_id,-1), arg_vendor_site_id);
Line: 653

      insert into mrp_sourcing_history
	(
	 inventory_item_id,
	 organization_id,
	 sourcing_rule_id,
	 source_org_id,
	 vendor_id,
	 vendor_site_id,
	 historical_allocation,
	 last_calculated_date,
	 last_updated_by,
	 last_update_date,
	 creation_date,
	 created_by,
	 last_update_login,
	 request_id,
	 program_application_id,
	 program_id,
	 program_update_date
	 )
	values (
		arg_item_id,
		arg_org_id,
		arg_sourcing_rule_id,
		decode(arg_source_org, NULL_VALUE, NULL, arg_source_org),
		decode(arg_vendor_id, NULL_VALUE, NULL, arg_vendor_id),
		decode(arg_vendor_site_id,NULL_VALUE, NULL, arg_vendor_site_id),
		x_total_alloc_qty,
		sysdate,
		1,
		sysdate,
		sysdate,
		1,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL
		);
Line: 724

      SELECT NVL(SUM(NVL(jobs.quantity_completed,0)),0)
        INTO   x_job_alloc_qty
        FROM   wip_discrete_jobs jobs
        WHERE  jobs.primary_item_id = arg_item_id
        AND    jobs.organization_id = arg_org_id
        AND    DECODE(mps_consume_profile_value,
                      1, jobs.mps_scheduled_completion_date,
                      jobs.scheduled_completion_date) between
        arg_start_date and NVL(arg_end_date,
                               Decode(mps_consume_profile_value,
                                      1, jobs.mps_scheduled_completion_date,
                                      jobs.scheduled_completion_date)
                               +1);
Line: 738

      SELECT
        Nvl(SUM(NVL(fs.quantity_completed,0)),0)
        INTO   x_fs_alloc_qty
        FROM   wip_flow_schedules fs
        WHERE  fs.primary_item_id = arg_item_id
        AND    fs.organization_id = arg_org_id
        AND    DECODE(mps_consume_profile_value,
                      1, fs.mps_scheduled_completion_date,
                      fs.scheduled_completion_date) between
        arg_start_date and NVL(arg_end_date,
                               DECODE(mps_consume_profile_value,
                                      1, fs.mps_scheduled_completion_date,
                                      fs.scheduled_completion_date)+1);
Line: 752

      SELECT
        Nvl(SUM(NVL(rep.daily_production_rate * rep.processing_work_days,0)),0)
        INTO   x_rep_alloc_qty
        FROM wip_repetitive_schedules rep,
        wip_repetitive_items wri,
        wip_entities we
        WHERE
        we.organization_id = arg_org_id
        AND    wri.wip_entity_id = we.wip_entity_id
        AND    we.primary_item_id = arg_item_id
        AND    wri.organization_id = we.organization_id
        AND    rep.wip_entity_id = we.wip_entity_id
        AND    rep.organization_id = wri.organization_id
        AND    rep.line_id = wri.line_id
        AND    rep.last_unit_completion_date between
        arg_start_date and NVL(arg_end_date,rep.last_unit_completion_date+1);
Line: 771

      SELECT NVL(SUM(
                     INV_CONVERT.inv_um_convert
                     (
                      arg_item_id,
                      6,
                      Nvl(rct.quantity,0),
                      NULL,
                      NULL,
                      rsl.unit_of_measure,
                      rsl.primary_unit_of_measure
                      )),0)
        INTO x_total_alloc_qty
        FROM rcv_shipment_lines rsl,
        rcv_transactions rct
        WHERE rct.shipment_line_id = rsl.shipment_line_id
        AND   rct.transaction_type = 'DELIVER'
        AND   rsl.from_organization_id = arg_source_org
        AND   rsl.to_organization_id = arg_org_id
        AND   rsl.item_id = arg_item_id
        AND   rct.transaction_date BETWEEN
              arg_start_date AND NVL(arg_end_date,rct.transaction_date +1);
Line: 798

      SELECT /*+ use_nl(rct,rsl, poh,pol)
                 INDEX(rct rcv_transactions_n15)
                 INDEX(rsl rcv_shipment_lines_u1)
                 INDEX(poh po_headers_u1)
                 INDEX(rol po_lines_u1) */
       NVL(SUM(
                     INV_CONVERT.inv_um_convert
                     (
                      arg_item_id,
                      6,
                      Nvl(rct.quantity,0),
                      NULL,
                      NULL,
                      rsl.unit_of_measure,
                      rsl.primary_unit_of_measure
                      )),0)
        INTO x_total_alloc_qty
        FROM po_lines_all pol,
        po_headers_all poh,
        rcv_shipment_lines rsl,
        rcv_transactions rct
        WHERE rct.shipment_line_id = rsl.shipment_line_id
        AND   rct.transaction_type = 'DELIVER'
        AND   rsl.po_header_id = poh.po_header_id
        AND   rsl.po_line_id = pol.po_line_id
        AND   poh.vendor_id = arg_vendor_id
        AND   NVL(poh.vendor_site_id,-99) = NVL(arg_vendor_site_id,-99)
        AND   pol.item_id = arg_item_id
        AND   rct.transaction_date between arg_start_date AND
                NVL(arg_end_date,rct.transaction_date +1);