The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT max(PLL.shipment_num) + 1
INTO X_shipment_num
FROM po_line_locations PLL
WHERE PLL.po_release_id = X_po_release_id;
SELECT max(PLL.shipment_num) + 1
INTO X_shipment_num
FROM po_line_locations PLL
WHERE PLL.po_line_id = X_po_line_id
AND PLL.shipment_type in ('STANDARD', 'PLANNED', 'PRICE BREAK');
-- If a shipment number is not selected, this is
-- the first shipment and a shipment number of
-- one should be returned.
--
IF (X_shipment_num is null) THEN
X_shipment_num := 1;
SELECT PLL.ship_to_location_id,
PLL.ship_to_organization_id,
PLL.quantity,
PLL.price_override,
PLL.promised_date,
PLL.need_by_date,
PLL.enforce_ship_to_location_code,
PLL.allow_substitute_receipts_flag,
PLL.receiving_routing_id ,
PLL.qty_rcv_tolerance ,
PLL.qty_rcv_exception_code ,
PLL.days_early_receipt_allowed ,
PLL.last_accept_date,
PLL.days_late_receipt_allowed,
PLL.receipt_days_exception_code ,
PLL.invoice_close_tolerance,
PLL.receive_close_tolerance,
PLL.accrue_on_receipt_flag,
PLL.receipt_required_flag,
PLL.inspection_required_flag
FROM PO_LINE_LOCATIONS PLL
WHERE PLL.line_location_id = X_source_shipment_id;
SELECT sum(PLL.quantity - nvl(PLL.quantity_cancelled,0))
INTO X_quantity_released
FROM po_line_locations PLL
WHERE PLL.po_line_id = X_source_id
AND PLL.shipment_type = 'SCHEDULED' ;
SELECT sum(PLL.quantity - nvl(PLL.quantity_cancelled,0))
INTO X_quantity_released
FROM po_line_locations PLL
WHERE PLL.source_shipment_id = X_source_id
AND PLL.shipment_type = 'SCHEDULED' ;
SELECT nvl(sum(nvl(POD.quantity_ordered,0)- nvl(POD.quantity_cancelled,0)),0)
INTO X_quantity_released
FROM po_distributions POD
WHERE POD.source_distribution_id = X_source_id ;