I want a table with another table. But one of the columns is mapped in the key table and you need to use already new values. Cannot use subquery.
The code is now:
MERGE INTO TABLE_2 ST USING (SELECT * FROM TABLE_1 FT LEFT JOIN KEY_TABLE ksubs ON ksubs.PK_ID = ft.PK_ID) joined ON (ksubs.NEW_PK_ID = ST.PK_ID AND FT.COL_2 = <константа>) WHEN MATCHED THEN UPDATE SET ST.COL_3 = FT.COL_3 Mistake in:
FT.COL_2 = <константа> FT.COL_2 is an invalid identifier (ORA-00904: invalid identifier).
Is it even possible to use a subquery as a source for MERGE?
joined. Use it, notFT. The same aboutksubs- Viktorovselect *., and I always considered this a vicious practice =) - Viktorov