UPdate table column + PL/SQL

Hi, I have a question, I have an update query that listed below. It give me an error : 'single-row subquery returns more than one row." Can anyone give me an hint why?

UPDATE table1 SET SVC_CD = 'ABC'
      where BD_NR = (
            select A.NVP_BID_NR from table1  A, table2  B WHERE A.FG_NR = B.FG_NR
              AND A.BD_NR = B.BD_NR
                         AND A.C_CD = 'OU' )
chenjhuaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jinesh KamdarCommented:
That's because ur inner SELECT query returned more than 1 row for a single row of the table being updated. Since Oracle found multiple rows returned, it couldn't have updated the source table correctly and hence, threw the exception.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jinesh KamdarCommented:
ORA-01427: single-row subquery returns more than one row

Cause: The outer query must use one of the keywords ANY, ALL, IN, or NOT IN to specify values to compare because the subquery returned more than one row.

Action: Use ANY, ALL, IN, or NOT IN to specify which values to compare or reword the query so only one row is retrieved.
0
johnsoneSenior Oracle DBACommented:
I think that you should have IN and not = with the sub-query.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.