Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Update multiple rows within same table(single rows query return more then 1 rows)

G.YOct 24 2021 — edited Oct 25 2021

I am facing the below error
single rows query return more then 1 rows

sql query--

UPDATE INV.SALE_C A
SET A.AMOUNT = ( SELECT (NVL(B.RATE,0) * NVL(B.qty,0)) - (NVL(B.DISCOUNT,0) * NVL(B.qty,0))
              FROM INV.SALE_C B 
              WHERE b.division_id = a.division_id
              AND A.ITEM_CODE = B.ITEM_CODE
              AND A.BARCODE = B.BARCODE
              AND A.INVOICE_NO = B.INVOICE_NO
              AND A.SRNO = B.SRNO ---( i am having error with this column values---duplicate)
               
              )
WHERE A.DIVISION_ID = 1
and A.barcode is not null
AND A.ITEM_CODE IS NOT NULL;

image.pngsame srno , like this there are so many rows, can i use rownum instead of srno column name
please help how to solve this issue

Comments
Post Details
Added on Oct 24 2021
2 comments
3,597 views