The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT wdd.delivery_detail_id,
wdd.serial_number,
wdd.transaction_temp_id,
wdd.source_line_id,
wdd.pickable_flag,
wdd.move_order_line_id,
wdd.ship_from_location_id,
wdd.organization_id,
wdd.inventory_item_id,
wdd.subinventory,
wdd.revision,
wdd.locator_id,
wdd.lot_number,
wdd.released_status,
wdd.requested_quantity,
wdd.picked_quantity,
wdd.cancelled_quantity,
wdd.shipped_quantity,
wdd.requested_quantity2,
wdd.picked_quantity2,
wdd.cancelled_quantity2,
wdd.shipped_quantity2,
wda.parent_delivery_detail_id,
wda.delivery_assignment_id,
wnd.planned_flag,
wnd.delivery_id,
nvl(wnd.status_code,'NO') status_code
FROM wsh_delivery_details wdd,
wsh_new_deliveries wnd,
wsh_delivery_assignments_v wda
WHERE wdd.delivery_detail_id = wda.delivery_detail_id
AND wda.delivery_id = wnd.delivery_id (+)
AND wdd.source_line_id = p_changed_attributes.source_line_id
AND wdd.source_code = p_source_code
AND nvl(wdd.line_direction, 'O') IN ('O','IO') -- J Inbound Logistics jckwok
AND wdd.delivery_detail_id = decode (p_changed_attributes.delivery_detail_id,
NULL , wdd.delivery_detail_id ,
p_changed_attributes.delivery_detail_id)
AND wdd.container_flag = 'N'
AND wdd.released_status <> 'D' -- New
ORDER BY decode(nvl(wnd.status_code,'NO'),'NO',1,'OP',2,'SA',3,10), -- sperera 940/945
decode(wda.parent_delivery_detail_id,NULL,1,10),
decode(wnd.planned_flag,'N',1,'Y',2,'F',3,10), --TP release
decode(wdd.released_status,'N',1,'R',2,'X',3,'B',4,'S',5,'Y',6,10),
nvl(wdd.requested_quantity,0) asc, -- This will make sure that maximum number of details are accounted for
wdd.delivery_detail_id;
WSH_DEBUG_SV.logmsg(l_module_name, 'DELETE ACTION NOT ALLOWED FOR SOURCE LINE ID: ' || P_CHANGED_ATTRIBUTES.SOURCE_LINE_ID );