Jump to content

update statement


somayajula_suresh

Recommended Posts

I wrote a query to update the records. I need to update no.of records. But it shows 1 row updated. Here I am givingthe code. Can any one please check the code and make the changes if needed.

UPDATE ordloc X1 SET    qty_received =  (select V.new_qty                   FROM ordloc x ,                       (SELECT order_no,a.location,a.qty_received,                        NVL(lead(a.qty_received)over (partition by a.order_no                         order by a.location),0) new_qty                       FROM   Ordloc a,Ordhead b                       WHERE  a.order_no=b.order_no                                      AND A.LOCation=B.LOCation                       AND    a.order_no in                      (select order_no from ordloc where qty_ordered=0                       and qty_received <>0 and b.status<>'C') v                    WHERE X.order_no = V.order_no                    AND   X.location = V.location                   AND   X.order_no =X1.order_no                   AND   X.location = X1.location) WHERE  EXISTS (select NULL                   FROM Ordloc x ,                       (SELECT a.order_no,a.location,a.qty_received,                        NVL(lead(a.qty_received)over (partition by                         a.order_no order by a.location),0) new_qty                       FROM   Ordloc a,Ordhead b                       WHERE  a.order_no=b.order_no                                      AND A.LOCation=B.LOCation                       AND    a.order_no in                     (select order_no from ordloc where qty_ordered=0                      and qty_received <>0 and b.status<>'C'))v                   WHERE X.order_no = V.order_no                    AND   X.location = V.location                   AND   X.order_no =X1.order_no                   AND   X.location = X1.location

Thank you.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...