Skip to content
Advertisement

How to update with inner join in Oracle

Could someone please verify whether inner join is valid with UPDATE statment in PL SQL? e.g.

Advertisement

Answer

This synthax won’t work in Oracle SQL.

In Oracle you can update a join if the tables are “key-preserved”, ie:

Assuming that b_pk is the primary key of b, here the join is updateable because for each row of A there is at most one row from B, therefore the update is deterministic.

In your case since the updated value doesn’t depend upon another table you could use a simple update with an EXIST condition, something like this:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement