Merge /*+ parallel (16)*/ into psx_cluster_audit_t_1 a
using psx_cluster_cross_ref_t_1 b
on (
a.psx_id=b.RECORD_ID
and a.PSX_BATCH_ID=b.PSX_BATCH_ID
and b.psx_batch_id='2411121519014999'
)
when matched then update set mpc_new=b.mpc where a.mpc_new is null
The above query giving:
SQL Error [42601]: ERROR: syntax error at or near "where"
Position: 234 error in postgresql
I tried with other clauses like ON
2
Answers
try this one
You have a couple syntax errors and a totally superfluous/misleading comment. So:
where
clause within thewhen matched
phase. Move it into theon
phase.update
within thewhen matched
phase must refer to only the table named in theinto
clause; therefore do not alias the column names.Taking all this your query becomes:
NOTE Not tested. No table description (ddl) nor test data supplied.