This can be done fine in SQL Server (whereas we can use FROM clause in UPDATE statement). But I'm fairly new to Oracle SQL. The scenario is simple like this. I have 2 tables (having the same number of rows). Now I need to update one column of this table to one column of another table by matching row_number
of each table.
I've referenced the Oracle UPDATE and this looks like the most promising approach:
update
(select * from
(select A1,
row_number() over (order by A1) as rn from A) d
join
(select B1,
row_number() over (order by B1) as rn from B) v on d.rn = v.rn)
set A1 = B1;
but it threw error saying this:
cannot modify a column which maps to a non key-preserved table
There are some examples involving UPDATE like this but it's not exactly like in my scenario because the matching condition does not involve any existing column of the base table (the table we need to update)