The following lines contain the word 'select', 'insert', 'update' or 'delete':
msc_sch_wb.atp_debug ('Atp_Adjusted_Cum: ' || 'Updated Unallocated Cum Date:Qty - '||
p_current_atp.atp_period(i) ||' : '|| p_unallocated_atp.atp_qty(i) );
SELECT
ATP_level
,scenario_id
,inventory_item_id
,request_item_id
,organization_id
,supplier_id
,supplier_site_id
,department_id
,resource_id
,supply_demand_date
,identifier1
,identifier2
,SUM(DECODE(supply_demand_type, 1, allocated_quantity, 0))
total_demand_quantity
,SUM(DECODE(supply_demand_type, 2, allocated_quantity, 0))
total_supply_quantity
,SUM(allocated_quantity)
,SUM(unallocated_quantity)
BULK COLLECT INTO
x_atp_period.Level,
x_atp_period.Scenario_Id,
x_atp_period.Inventory_Item_Id,
x_atp_period.Request_Item_Id,
x_atp_period.Organization_id,
x_atp_period.Supplier_ID,
x_atp_period.Supplier_Site_ID,
x_atp_period.Department_id,
x_atp_period.Resource_id,
x_atp_period.Period_Start_Date,
x_atp_period.Identifier1,
x_atp_period.Identifier2,
x_atp_period.Total_Demand_Quantity,
x_atp_period.Total_Supply_Quantity,
x_atp_period.Period_Quantity,
p_unallocated_atp.atp_qty
FROM msc_atp_sd_details_temp
GROUP BY
supply_demand_date
,ATP_level
,scenario_id
,inventory_item_id
,request_item_id
,organization_id
,supplier_id
,supplier_site_id
,department_id
,resource_id
,identifier1
,identifier2
ORDER BY supply_demand_date;