I want to run update statement on Oracle 11g, but it fails with the following error:
SQL Error: ORA-01427: single-row subquery returns more than one row 01427. 00000 - "single-row subquery returns more than one row"
Here's what I'm trying to do in pseudocode:
Update Table1
Set Flag_Column=1
Where
Table1.ColumnX=Table2.ColumnX
and
Table1.ColumnY=Table2.ColumunY
Is there a way to do this in Oracle SQL?
My code looks like this:
update Table1
set Flag_Column=1
where ColumnX=
(select distinct Table1.ColumnX
from Table1, Table2
where Table1.ColumnX=Table2.ColumnX
and Table1.ColumnY=Table2.ColumnY)
and ColumnY=
(select distinct Table1.ColumnY
from Table1, Table2
where Table1.ColumnX=Table2.ColumnX
and Table1.ColumnY=Table2.ColumnY)