Hello,
I just want to say that I searched a LOT about this error on the wed and the only solution that I found is that my query needs to return only one record for it to work.
Basically, I need to update 3 fields in one table from another table where emails match on both tables and IDs are different.
Example:
update table_1 a
set (a.id, a.name, a.dept) =
(select distinct b.id, b.name_new, b.dept.new
from
table_2 b,
table_1 a
where
a.email in (select b.email from table_2 b) and (a.id) <> (b.id)
);
ERROR at line 6:
ORA-01427: single-row subquery returns more than one row
The only solution that I found if I add rownum <=1 but that is not a solution really because it returns only one row and updates everything by that one row which is incorrect it just proves that my query is working but I only wants to have one row.
Please suggest if I can rewrite the query any different so I can update my table.
Thank you.