路虽弥,不行不至;事虽少,不做不成。
分类: Oracle
2009-02-06 14:22:34
如何解决订单行已关闭或取消,但订单行保留却无法释放?
有时我们会碰到订单行已经关闭或已取消,但订单行的保留数据并未随之自动释放,为解决这一问题,特提供如下方法.
第一种情况: 已知订单号码
1>
Update inv.mtl_reservations m
Set m.primary_reservation_quantity =0,
m.Reservation_quantity = 0,
m.Last_update_by=-2471362
Where m.primary_reservation_quantity>0
And exists ( select ‘t’
From ont.oe_order_headers_all h,
ont.oe_order_lines_all l
where h.header_id=l.header_id
and h.order_number=’&order_number’
and m.demand_source_line_id=l.line_id)
2>
Update inv.mtl_demand d
set d.primary_uom_quantity =0,
d.line_item_quantity =0,
d.completed_quantity =0,
d.line_item_reservation_qty=0,
d.reservation_quantity=0,
d.last_updated_by=-2471362
where d.demand_source_type in (2,8)
and d.reservation_type =2
and exists (select ‘t’
From ont.oe_order_headers_all h,
ont.oe_order_lines_all l
where h.header_id=l.header_id
and h.order_number=’&order_number’
and m.demand_source_line =l.line_id)
3>
Delete from inv.mtl_reservations m where m.last_updated_by=-2471362
4>
Delete from inv.mtl_demand d where d.last_updated_by=-2471362
---未完待续---