DBA Data[Home] [Help]

APPS.MSC_BAL_UTILS SQL Statements

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

Line: 33

  select 1
  from user_tab_columns
  where  table_name ='OE_MRP_OPEN_DEMANDS_V'
  and column_name = p_column_name;
Line: 44

     'insert into mrp_atp_schedule_temp '||
     '(action, '||
     'calling_module, '||
	 'sequence_number, '||
	 'session_id, '||
	 'scenario_id, '||
	 'firm_flag, '||
	 'status_flag, '||
	 'insert_flag, '||
	 'order_header_id, '||
	 'order_number, '||
	 'order_line_id, '||
	 'order_line_number, '||
	 'inventory_item_id, '||
	 'inventory_item_name, '||
	 'sr_instance_id, '||
	 'source_organization_id, '||
	 'source_organization_code, '||
	 'old_source_organization_code, '||
	 'quantity_ordered, '||
	 'uom_code, '||
	 'scheduled_ship_date, '||
	 'scheduled_arrival_date, '||
	 'old_line_schedule_date, '||
	 'requested_ship_date, '||
	 'requested_arrival_date, '||
	 'promise_date, '||
	 'latest_acceptable_date, '||
	 'delivery_lead_time, '||
	 'ship_method, '||
	 'demand_class, '||
	 'ship_set_id, '||
	 'ship_set_name, '||
	 'arrival_set_id, '||
	 'arrival_set_name, '||
	 'customer_id, '||
	 'customer_site_id, '||
	 'customer_name, '||
	 'customer_location, '||
	 'shipment_number, '||
	 'option_number, '||
	 'old_source_organization_id, '||
	 'old_demand_class, '||
         'creation_date, '||
         'created_by, '||
         'last_update_date, '||
         'last_updated_by, '||
         'last_update_login, '||
	 'freight_carrier, '||
     'flow_status_code '||
     ') ( '||
	 'select '||
	 '110, '||
	 '-1, '||
     ':l_seq_num, '||
	 ':p_session_id, '||
	 '1, ' || -- scenario_id
	 '2, '||  -- firm_flag 2 -> NO
	 '1, '||  -- status_flag 1 -> INPUT
	 ':l_profile_value, '||  -- insert_flag 1 -> INPUT
	 'omodv.header_id, '||
	 'omodv.order_number, '||
	 'omodv.line_id, '||
	 'omodv.line_number, '||
	 'omodv.inventory_item_id, '||
	 'omodv.ordered_item, '||
	 'maai.instance_id, '||
	 'decode(:p_overwrite,1,NULL,omodv.ship_from_org_id), '||
	 'decode(:p_overwrite,1,NULL,ood.organization_code), '||
	 'ood.organization_code, '||
	 'omodv.ordered_quantity, '||
	 'omodv.order_quantity_uom, '||
	 'omodv.schedule_ship_date, '||
	 'omodv.schedule_arrival_date, '||
	 'decode(omodv.schedule_ship_date,NULL, '||
	 'omodv.schedule_arrival_date,omodv.schedule_ship_date), '||
	 'omodv.request_ship_date, '||
	 'omodv.request_arrival_date, '||
	 'omodv.promise_date, '||
	 'omodv.latest_acceptable_date, '||
	 'omodv.delivery_lead_time, '||
	 'omodv.shipping_method_code, '||
	 'omodv.demand_class_code, '||
	 'omodv.ship_set_id, '||
	 'omodv.ship_set_name, '||
	 'omodv.arrival_set_id, '||
	 'omodv.arrival_set_name, '||
	 'omodv.sold_to_org_id, '||
	 'omodv.ship_to_org_id, '||
	 'hp.party_name, '||
	 'ras.location, '||
	 'omodv.shipment_number, '||
	 'omodv.option_number, '||
	 'omodv.ship_from_org_id, '||
	 'omodv.demand_class_code, '||
	 'sysdate, '||
	 'FND_GLOBAL.USER_ID, '||
	 'sysdate, '||
	 'FND_GLOBAL.USER_ID, '||
	 'FND_GLOBAL.USER_ID ';
Line: 191

         select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
         into l_time
         from dual;
Line: 201

   delete from mrp_atp_schedule_temp
   where session_id = -444;
Line: 213

    l_stmt := ' INSERT into mrp_atp_schedule_temp
                         (order_line_id,
                          order_header_id,
                          scenario_id,
                          session_id,
                          inventory_item_id,
                          ship_set_id,
                          arrival_set_id,
                          sequence_number,
                          ato_model_line_id,
                          top_model_line_id,
                          inventory_item_name, ---item_type_code
                          order_number,
                          scheduled_ship_date,
                          scheduled_arrival_date,
                          requested_ship_date,
                          requested_arrival_date,
                          promise_date,
                          sr_instance_id)
                SELECT  omodv.line_id,
                        omodv.header_id,
                        0,
                        -444,
                        0,
                        omodv.ship_set_id,
                        omodv.arrival_set_id,
                        0,
                        omodv.ato_line_id,
                        omodv.top_model_line_id,
                        omodv.item_type_code,
                        omodv.order_number,
                        omodv.schedule_ship_date ,
                        omodv.schedule_arrival_date,
                        omodv.request_ship_date,
                        omodv.request_arrival_date,
                        omodv.promise_date,
                        omodv.planning_priority
                FROM
                        oe_mrp_open_demands_v omodv
                WHERE   1=1 ';
Line: 259

           l_stmt := ' INSERT into mrp_atp_schedule_temp
                         (order_line_id,
                          order_header_id,
                          scenario_id,  -- not null col
                          session_id,   -- not null col
                          inventory_item_id, -- not null col
                          ship_set_id,
                          arrival_set_id,
                          sequence_number,
                          ato_model_line_id,
                          top_model_line_id,
                          inventory_item_name, -- -item_type_code
                          order_number,
                          scheduled_ship_date,
                          scheduled_arrival_date,
                          requested_ship_date,
                          requested_arrival_date,
                          promise_date)
                  SELECT
                        omodv.line_id,
                        omodv.header_id,
                        0,
                        -444,
                        0,
                        omodv.ship_set_id,
                        omodv.arrival_set_id,
                        0,
                        omodv.ato_line_id,
                        omodv.top_model_line_id,
                        omodv.item_type_code,
                        omodv.order_number,
                        omodv.schedule_ship_date ,
                        omodv.schedule_arrival_date,
                        omodv.request_ship_date,
                        omodv.request_arrival_date,
                        omodv.promise_date
                FROM
                        oe_mrp_open_demands_v omodv
                WHERE   1=1 ';
Line: 309

                        '   and not  exists ( select 1
                        from wsh_delivery_details
                        where source_line_id =omodv.line_id
                        and source_code =  '||' ''OE'' '||
                      '  and released_status in  ( '||' ''Y'' '|| ',  '
                                                    ||' ''S'' '|| ',  '
                                                    ||' ''C'' '|| ' ) )  ';
Line: 326

      msc_sch_wb.atp_debug(' INSERTED into mrp table   '|| SQL%ROWCOUNT);
Line: 330

    l_stmt:= 'select distinct
            omodv1.line_id,
            omodv1.ship_set_id,
            omodv1.arrival_set_id,
            0,
            omodv1.ato_line_id,
            omodv1.top_model_line_id,
            omodv1.item_type_code,
            omodv1.order_number,
            omodv1.schedule_ship_date,
            omodv1.schedule_arrival_date,
            omodv1.request_ship_date,
            omodv1.request_arrival_date,
            omodv1.promise_date,
            omodv1.order_number,
            omodv1.planning_priority
    from oe_mrp_open_demands_v omodv1,
         mrp_atp_schedule_temp mrp
    where mrp.session_id = -444
    and   mrp.order_header_id = omodv1.header_id
    and  ( mrp.order_line_id = omodv1.line_id
           OR
             nvl(mrp.ship_set_id, -1) = nvl(omodv1.ship_set_id, -2)
           OR
             nvl(mrp.arrival_set_id, -1) = nvl(omodv1.arrival_set_id, -2))';
Line: 356

           l_stmt:= 'select distinct
            omodv1.line_id,
            omodv1.ship_set_id,
            omodv1.arrival_set_id,
            0,
            omodv1.ato_line_id,
            omodv1.top_model_line_id,
            omodv1.item_type_code,
            omodv1.order_number,
            omodv1.schedule_ship_date,
            omodv1.schedule_arrival_date,
            omodv1.request_ship_date,
            omodv1.request_arrival_date,
            omodv1.promise_date,
            omodv1.order_number,
            0
    from oe_mrp_open_demands_v omodv1,
         mrp_atp_schedule_temp mrp
    where mrp.session_id = -444
    and   mrp.order_header_id = omodv1.header_id
    and  ( mrp.order_line_id = omodv1.line_id
           OR
             nvl(mrp.ship_set_id, -1) = nvl(omodv1.ship_set_id, -2)
           OR
             nvl(mrp.arrival_set_id, -1) = nvl(omodv1.arrival_set_id, -2))';
Line: 388

                        '   and not  exists ( select 1
                        from wsh_delivery_details
                        where source_line_id =omodv1.line_id
                        and source_code =  '||' ''OE'' '||
                      '  and released_status in  ( '||' ''Y'' '|| ',  '
                                                    ||' ''S'' '|| ',  '
                                                    ||' ''C'' '|| ' ) )  ';
Line: 444

      msc_sch_wb.atp_debug('POPULATE_TEMP_TABLE : ' || ' Num of order lines selected '||num_of_lines);
Line: 612

         select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
         into l_time
         from dual;
Line: 651

     SELECT
     Rowidtochar(a.ROWID),
     a.inventory_item_id,
     a.inventory_item_name,
     a.organization_id,
     a.sr_instance_id,
     Decode(override_flag,'Y',Nvl(a.firm_source_org_id,
                                  a.source_organization_id),
                                  a.source_organization_id),
     Decode(override_flag,'Y',Nvl(a.firm_source_org_code,
                                  a.source_organization_code),
                                  a.source_organization_code),
     a.order_line_id,
     a.Scenario_Id,
     a.Order_Header_Id,
     a.order_number,
     a.Calling_Module,
     a.Customer_Id,
     a.Customer_Site_Id,
     a.Destination_Time_Zone,
     0,                 --  send qty = 0  to atp
     a.uom_code,
     Decode(override_flag,'Y', Nvl(a.firm_ship_date,a.requested_ship_date),
                                   a.requested_ship_date),
     Decode(override_flag,'Y', Nvl(a.firm_arrival_date,a.requested_arrival_date)
                                 , a.requested_arrival_date),
     date_null,     --  a.Earliest_Acceptable_Date,
     a.Latest_Acceptable_Date,
     a.Delivery_Lead_Time,
     a.Freight_Carrier,
     a.Ship_Method,
     a.Demand_Class,
     a.Ship_Set_Name,
     -- When it is put back into the table the name will be used.
     a.arrival_set_id, --a.Arrival_Set_Name
        -- we don't append source_org since they can be different
        -- and we don't need it since we don't have pick sources
     a.Override_Flag,
     a.Action,
     date_null,     --a.Ship_Date, ??? scheduled_ship_date
     number_null,   -- a.Available_Quantity,
     number_null,   -- a.Requested_Date_Quantity,
     date_null,     -- a.Group_Ship_Date,
     date_null,     -- a.Group_Arrival_Date,
     a.Vendor_Id,
     a.Vendor_Name,
     a.Vendor_Site_Id,
     a.Vendor_Site_Name,
     a.Insert_Flag,
     number_null,    -- a.Error_Code,
     char_1_null,     -- a.Error_Message
     a.old_source_organization_id,
     a.old_demand_class,
     a.atp_lead_time, -- bug 1303240
     null, --substitution_typ_code,
     null,  -- REQ_ITEM_DETAIL_FLAG
     2,  -- ATP Pegging
     a.assignment_set_id,  -- ATP Pegging
     a.sequence_number,
     a.firm_flag,
     a.order_line_number,
     a.option_number,
     a.shipment_number,
     a.item_desc,
     a.old_line_schedule_date,
     a.old_source_organization_code,
     a.firm_source_org_id,
     a.firm_source_org_code,
     a.firm_ship_date,
     a.firm_arrival_date,
     a.ship_method_text,
     a.ship_set_id,
     a.arrival_set_id,
     a.PROJECT_ID,
     a.TASK_ID,
     a.PROJECT_NUMBER,
     a.TASK_NUMBER,
     a.Top_Model_line_id,
     a.ATO_Model_Line_Id,
     a.Parent_line_id,
     a.Config_item_line_id,
     a.Validation_Org,
     a.Component_Sequence_ID,
     a.Component_Code,
     a.line_number,
     a.included_item_flag
     bulk collect into
     x_atp_rec.row_id,
     x_atp_rec.Inventory_Item_Id,
     x_atp_rec.Inventory_Item_Name,
     x_atp_rec.organization_id,
     x_atp_rec.instance_id,
     x_atp_rec.Source_Organization_Id,
     x_atp_rec.Source_Organization_Code,
     x_atp_rec.Identifier,
     x_atp_rec.Scenario_Id,
     x_atp_rec.Demand_Source_Header_Id,
     x_atp_rec.order_number,
     x_atp_rec.Calling_Module,
     x_atp_rec.Customer_Id,
     x_atp_rec.Customer_Site_Id,
     x_atp_rec.Destination_Time_Zone,
     x_atp_rec.Quantity_Ordered,
     x_atp_rec.Quantity_UOM,
     x_atp_rec.Requested_Ship_Date,
     x_atp_rec.Requested_Arrival_Date,
     x_atp_rec.Earliest_Acceptable_Date,
     x_atp_rec.Latest_Acceptable_Date,
     x_atp_rec.Delivery_Lead_Time,
     x_atp_rec.Freight_Carrier,
     x_atp_rec.Ship_Method,
     x_atp_rec.Demand_Class,
     x_atp_rec.Ship_Set_Name,
     x_atp_rec.Arrival_Set_Name,
     x_atp_rec.Override_Flag,
     x_atp_rec.Action,
     x_atp_rec.Ship_Date,
     x_atp_rec.Available_Quantity,
     x_atp_rec.Requested_Date_Quantity,
     x_atp_rec.Group_Ship_Date,
     x_atp_rec.Group_Arrival_Date,
     x_atp_rec.Vendor_Id,
     x_atp_rec.Vendor_Name,
     x_atp_rec.Vendor_Site_Id,
     x_atp_rec.Vendor_Site_Name,
     x_atp_rec.Insert_Flag,
     x_atp_rec.Error_Code,
     x_atp_rec.message,
     x_atp_rec.old_source_organization_id,
     x_atp_rec.old_demand_class,
     x_atp_rec.atp_lead_time,  -- bug 1303240
     x_atp_rec.substitution_typ_code,
     x_atp_rec.REQ_ITEM_DETAIL_FLAG,
     x_atp_rec.attribute_02,   -- ATP Pegging
     x_atp_rec.attribute_03,
     x_atp_rec.sequence_number,
     x_atp_rec.firm_flag,
     x_atp_rec.order_line_number,
     x_atp_rec.option_number,
     x_atp_rec.shipment_number,
     x_atp_rec.item_desc,
     x_atp_rec.old_line_schedule_date,
     x_atp_rec.old_source_organization_code,
     x_atp_rec.firm_source_org_id,
     x_atp_rec.firm_source_org_code,
     x_atp_rec.firm_ship_date,
     x_atp_rec.firm_arrival_date,
     x_atp_rec.ship_method_text,
     x_atp_rec.ship_set_id,
     x_atp_rec.arrival_set_id,
     x_atp_rec.PROJECT_ID,
     x_atp_rec.TASK_ID,
     x_atp_rec.PROJECT_NUMBER,
     x_atp_rec.TASK_NUMBER,
     x_atp_rec.Top_Model_line_id,
     x_atp_rec.ATO_Model_Line_Id,
     x_atp_rec.Parent_line_id,
     x_atp_rec.Config_item_line_id,
     x_atp_rec.Validation_Org,
     x_atp_rec.Component_Sequence_ID,
     x_atp_rec.Component_Code,
     x_atp_rec.line_number,
     x_atp_rec.included_item_flag
     from mrp_atp_schedule_temp a
     where a.session_id = p_session_id
     and a.status_flag = 1
     order by a.sequence_number;
Line: 914

         select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
         into l_time
         from dual;
Line: 921

  select quantity_ordered, order_line_id, session_id
  bulk collect into
  p_atp_qty_ordered_temp.quantity_ordered,
  p_atp_qty_ordered_temp.order_line_id,
  p_atp_qty_ordered_temp.session_id
  from mrp_atp_schedule_temp
  where session_id = p_session_id
  and status_flag =1 ;
Line: 932

         select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
         into l_time
         from dual;
Line: 942

         select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
         into l_time
         from dual;
Line: 947

  update_schedule_qties(p_atp_qty_ordered_temp,
                        l_return_status,
                        l_error_message);
Line: 954

         select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
         into l_time
         from dual;
Line: 964

         select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
         into l_time
         from dual;
Line: 971

         msc_sch_wb.atp_debug('RESCHEDULE: ' || ' error is update_qty '|| l_error_message);
Line: 979

PROCEDURE  update_schedule_qties(p_atp_qty_ordered_temp IN MSC_BAL_UTILS.ATP_QTY_ORDERED_TYP,
                        p_return_status out nocopy VARCHAR2,
                        p_error_message out nocopy VARCHAR2) IS
l_count  NUMBER :=0;
Line: 987

  select count(*)
  INTO l_count
  from mrp_atp_schedule_temp
  where session_id = p_atp_qty_ordered_temp.session_id(1)
  and status_flag = 1;
Line: 992

  msc_sch_wb.atp_debug('MSC_BAL_UTILS.update_schedule_qties status_flag = 1 rec are '|| l_count);
Line: 995

  select count(*)
  INTO l_count
  from mrp_atp_schedule_temp
  where session_id = p_atp_qty_ordered_temp.session_id(1)
  and status_flag = 2;
Line: 1000

  msc_sch_wb.atp_debug('MSC_BAL_UTILS.update_schedule_qties status_flag = 2 rec are '|| l_count);
Line: 1003

  select count(*)
  INTO l_count
  from mrp_atp_schedule_temp
  where session_id = p_atp_qty_ordered_temp.session_id(1);
Line: 1007

  msc_sch_wb.atp_debug('MSC_BAL_UTILS.update_schedule_qties TOTAL  rec are '|| l_count);
Line: 1012

    update mrp_atp_schedule_temp
    set status_flag = 1,
    quantity_ordered = p_atp_qty_ordered_temp.quantity_ordered(lCounter)
    where session_id =p_atp_qty_ordered_temp.session_id(lCounter)
    and order_line_id = p_atp_qty_ordered_temp.order_line_id(lCounter)
    and status_flag = 2 ;
Line: 1020

 msc_sch_wb.atp_debug('MSC_BAL_UTILS.update_schedule_qties ' ||p_atp_qty_ordered_temp.order_line_id.COUNT);
Line: 1022

  select count(*)
  INTO l_count
  from mrp_atp_schedule_temp
  where session_id = p_atp_qty_ordered_temp.session_id(1);
Line: 1026

  msc_sch_wb.atp_debug('MSC_BAL_UTILS.update_schedule_qties TOTAL  rec are '|| l_count);
Line: 1035

END  update_schedule_qties;
Line: 1055

select count(*)
from mrp_atp_schedule_temp
where session_id = p_session_id
and status_flag = 2;
Line: 1072

   select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
   into l_time
   from dual;
Line: 1083

    delete from mrp_atp_schedule_temp
    where session_id = p_session_id
    and status_flag = 1;
Line: 1087

    delete from mrp_atp_details_temp
    where session_id = p_session_id;
Line: 1090

    update mrp_atp_schedule_temp
    set status_flag = 1
    where session_id = p_session_id
    and status_flag = 2;
Line: 1108

  select quantity_ordered, order_line_id, session_id
  bulk collect into
  p_atp_qty_ordered_temp.quantity_ordered,
  p_atp_qty_ordered_temp.order_line_id,
  p_atp_qty_ordered_temp.session_id
  from mrp_atp_schedule_temp
  where session_id = p_session_id
  and status_flag =1 ;
Line: 1117

  update_schedule_qties(p_atp_qty_ordered_temp,
                        l_return_status,
                        l_error_message);
Line: 1131

          select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
          into l_time
          from dual;
Line: 1154

           select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
           into l_time
           from dual;
Line: 1166

             select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
             into l_time
             from dual;
Line: 1216

                 ' error in update_qty '|| l_error_message);
Line: 1240

   select 1
   from user_tab_columns
   where table_name ='OE_MRP_OPEN_DEMANDS_V'
   and column_name ='FLOW_STATUS_CODE';
Line: 1252

    ' update mrp_atp_schedule_temp a set flow_status_code = '||
    '   ( select flow_status_code from oe_mrp_open_demands_v b '||
    '     where  a.order_line_id = b.line_id ) '||
    ' where  a.session_id = :p_session_id ';
Line: 1269

   select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
   into l_time
   from dual;
Line: 1295

           select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
           into l_time
           from dual;
Line: 1304

           select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
           into l_time
           from dual;
Line: 1321

   select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
   into l_time
   from dual;
Line: 1335

   select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS')
   into l_time
   from dual;
Line: 1432

      SELECT  mrp.order_line_id,
              omodv.org_id,
              mrp.order_header_id,
              mrp.source_organization_id,
              nvl(mrp.group_ship_date,mrp.scheduled_ship_date),
              nvl(mrp.group_arrival_date,mrp.scheduled_arrival_date),
              to_date(null), --earliest_ship_date
              mrp.delivery_lead_time,
              mrp.ship_method,
              decode(mrp.firm_flag, 1, 'Y', 2, 'N')
      FROM  mrp_atp_schedule_temp mrp,
            oe_mrp_open_demands_v omodv
      WHERE mrp.session_id = p_session_id
            AND mrp.order_line_id = omodv.line_id
            AND mrp.order_header_id = omodv.header_id
            AND mrp.status_flag = 2
            AND (mrp.error_code is NULL OR
                (mrp.error_code is not NULL and mrp.error_code  IN ('0','150','61')))
     ORDER BY  omodv.org_id, mrp.order_header_id, omodv.arrival_set_id,
               omodv.ship_set_id, omodv.top_model_line_id, omodv.ato_line_id;
Line: 1498

                           ' before calling Update_Scheduling_Results '
			    ||p_so_table.count);
Line: 1502

     select ltrim(rtrim(value))
     into l_dir
     from (select value from v$parameter2
           where name='utl_file_dir' order by rownum desc)
     where rownum <2;
Line: 1509

     select value
     into l_dir
     from v$parameter
     where name = 'utl_file_dir';
Line: 1538

   SELECT oe_msg_request_id_s.nextval
   INTO   l_request_id
   FROM   dual;
Line: 1542

   OE_SCHEDULE_GRP.Update_Scheduling_Results(
            p_so_table,
            l_request_id,
            x_return_status);
Line: 1549

                          || ' after calling Update_Results_from_backlog_wb '
                          ||x_return_status||' '|| x_return_status);
Line: 1573

          x_msg_data := 'Unexpected error in oe_order_sch_util.Update_Results_from_backlog_wb ';
Line: 1622

      oe_order_sch_util.Update_Results_from_backlog_wb
	( mast_table
	  , x_msg_count
	  , x_msg_data
	  , x_return_status);
Line: 1629

         msc_sch_wb.atp_debug('call_oe_api: ' || ' after calling Update_Results_from_backlog_wb II '
			     ||x_return_status||' '||x_msg_data);
Line: 1643

	 x_msg_data := 'Unexpected error in oe_order_sch_util.Update_Results_from_backlog_wb II ';
Line: 1655

PROCEDURE update_seq(p_session_id               NUMBER,
		     p_seq_alter       IN OUT   NoCopy mrp_bal_utils.seq_alter,
		     x_msg_count       OUT      NoCopy NUMBER,
		     x_msg_data        OUT      NoCopy VARCHAR2,
		     x_return_status   OUT      NoCopy VARCHAR2)
  IS
     l_old_seq NUMBER;
Line: 1675

   delete from mrp_atp_schedule_temp
   where session_id = p_session_id
   and status_flag = -88;
Line: 1682

      msc_sch_wb.atp_debug(' entered update_seq '
                      ||p_seq_alter.order_line_id.COUNT);
Line: 1687

     INSERT INTO mrp_atp_schedule_temp (session_id,
                                        inventory_item_id,
                                        scenario_id,
                                        status_flag,
                                        sequence_number,
                                        order_line_id,
                                        quantity_ordered, --old_seq_num,
                                        available_quantity) --sequence_diff)
     VALUES (p_session_id,
             -88,
             -88,
             -88,
             p_seq_alter.seq_num(j),
             p_seq_alter.order_line_id(j),
             p_seq_alter.orig_seq_num(j),
             p_seq_alter.seq_diff(j));
Line: 1705

      l_stmt := ' SELECT
              sequence_number,
              order_line_id,
              quantity_ordered,          --old_seq_num,
              available_quantity         --sequence_diff
              FROM mrp_atp_schedule_temp
              WHERE status_flag = -88
              AND session_id = '||p_session_id
              || 'order by sequence_number';
Line: 1716

  select count(*)
  INTO l_num_rec
  from mrp_atp_schedule_temp
  where status_flag = -88
  and session_id = p_session_id;
Line: 1755

     delete from mrp_atp_schedule_temp
     where session_id = p_session_id
     and status_flag = -88;
Line: 1760

     SELECT MAX(sequence_number)
     INTO l_max_seq
     FROM mrp_atp_schedule_temp
     WHERE session_id = p_session_id
     and status_flag = 1;
Line: 1783

	 select sequence_number, sequence_number + p_seq_alter.seq_diff(j)
	   into l_old_seq, l_new_seq
	   from mrp_atp_schedule_temp
	   where
	   order_line_id = p_seq_alter.order_line_id(j)
	   and session_id = p_session_id
           and status_flag = 1;
Line: 1791

	 select sequence_number, sequence_number + p_seq_alter.seq_diff(j)
	   into l_old_seq, l_new_seq
	   from mrp_atp_schedule_temp
	   where
	   NVL(p_seq_alter.ship_set_id(j),p_seq_alter.arrival_set_id(j))
	   = Decode(p_seq_alter.ship_set_id(j),NULL, arrival_set_id, ship_set_id)
	   and session_id = p_session_id
           and status_flag = 1;
Line: 1806

         msc_sch_wb.atp_debug('update_seq: ' || ' old seq '||l_old_seq||' new_seq '||l_new_seq);
Line: 1816

	 -- select all affected nodes including the changed node
	 -- second decode. depening on the direction of change, update the
	 -- affected nodes.
	 IF PG_DEBUG in ('Y', 'C') THEN
	    msc_sch_wb.atp_debug('update_seq: ' || ' b4 update ');
Line: 1823

          update mrp_atp_schedule_temp mast
            set mast.sequence_number = p_seq_alter.seq_num(j)
             , last_update_date = sysdate
             , last_updated_by = FND_GLOBAL.USER_ID
             , last_update_login = FND_GLOBAL.USER_ID
         WHERE mast.session_id = p_session_id
           AND mast.order_line_id = p_seq_alter.order_line_id(j) ;
Line: 1832

	 update mrp_atp_schedule_temp mast
	   set mast.sequence_number = Decode( Sign(p_seq_alter.seq_diff(j)),
					 -1,mast.sequence_number + 1,
				          1, mast.sequence_number -1)
	   -- dsting
	   , last_update_date = sysdate
	   , last_updated_by = FND_GLOBAL.USER_ID
	   , last_update_login = FND_GLOBAL.USER_ID
	   WHERE
	   mast.sequence_number BETWEEN
	   Decode(Sign(p_seq_alter.seq_diff(j)),
		  -1, p_seq_alter.seq_num(j),
		  +1, l_old_seq) AND
	   Decode(Sign(p_seq_alter.seq_diff(j)),
		  -1, l_old_seq,
		  +1, p_seq_alter.seq_num(j))
	   AND mast.session_id = p_session_id
           AND mast.order_line_id <>  p_seq_alter.order_line_id(j) ;
Line: 1853

              update mrp_atp_schedule_temp mast
              set mast.sequence_number = record_firm_filter.seq_num(b)
              , last_update_date = sysdate
              , last_updated_by = FND_GLOBAL.USER_ID
              , last_update_login = FND_GLOBAL.USER_ID
              WHERE
              mast.session_id = p_session_id
              AND mast.order_line_id  =    record_firm_filter.order_line_id(b) ;
Line: 1863

                msc_sch_wb.atp_debug('IN THE LOOP FOR FIRM: ' || '  1 after update '||
                                                            ' seq num '||record_firm_filter.seq_num(b)||
                                                            ' line_id  ' || record_firm_filter.order_line_id(b) || '  ' ||SQL%ROWCOUNT);
Line: 1869

              update mrp_atp_schedule_temp mast
              set mast.sequence_number =  Decode( Sign(p_seq_alter.seq_diff(j)),
                                         -1, mast.sequence_number + 1,
                                          1, mast.sequence_number -1)
              where
              mast.sequence_number = record_firm_filter.seq_num(b)
              and mast.order_line_id <>  record_firm_filter.order_line_id(b)
              and mast.session_id = p_session_id;
Line: 1879

                msc_sch_wb.atp_debug('IN THE LOOP FOR FIRM: ' || '  2  after update '||SQL%ROWCOUNT);
Line: 1885

	    msc_sch_wb.atp_debug('update_seq: ' || ' after update '||SQL%ROWCOUNT);
Line: 1897

         msc_sch_wb.atp_debug('Excp in update_seq '||Substr(Sqlerrm,1,80));
Line: 1899

      x_msg_data := 'Excp in update_seq '||Substr(Sqlerrm,1,80);
Line: 1902

END update_seq;