You can only specify columns that reference the source or target tables for the MERGE request in the ON, WHEN MATCHED, or WHEN NOT MATCHED clauses.
The following MERGE request is not valid because it references a column in its ON clause, t4.x4, that is neither from the source nor the target table for the request.
MERGE INTO t1
USING (SELECT x2, y2, z3
FROM t2, t3
WHERE y2=10) AS s
ON x1=y2 AND t4.x4=z2
WHEN MATCHED THEN
UPDATE SET z1=10
WHEN NOT MATCHED THEN
INSERT (y2, z2, x2);
The following MERGE request is not valid because it references a table and column in its ON clause, t3.x4, that are neither the source nor the target for the request.
MERGE INTO t1
USING (SELECT x2, y2, z3
FROM t2, t3
WHERE y2=10) AS s
ON x1=y2 AND t3.x4=z2
WHEN MATCHED THEN
UPDATE SET z1=10
WHEN NOT MATCHED THEN
INSERT (y2, z2, x2);