SAP Knowledge Base Article - Preview

3073857 - MERGE raises a 451 error when the same table is specified as a target and a source table - SAP ASE

Symptom

  • A MERGE statement raises a 451 error when the same table is specified as a target table and a source table and different MERGE actions are given in WHEN MATCHED and WHEN NOT MATCHED clauses.

merge into test_table using (select * from test_table where c2 = 30) a on test_table.c1=a.c1 and test_table.c2 = 20
when matched then update set c2 = 30
when not matched then insert values (a.c1, 0, 0)
go
Msg 451, Level 16, State 1:
Server 'ASE16', Line 1:
MERGE is not allowed because different MERGE actions are referenced in the same WHEN [NOT] MATCHED clause.


Read more...

Environment

  • SAP Adaptive Server Enterprise (ASE) 15.7
  • SAP Adaptive Server Enterprise (ASE) 16.0

Product

SAP Adaptive Server Enterprise 15.7 ; SAP Adaptive Server Enterprise 16.0

Keywords

825136, CR825136, CR#825136, selfjoin, self-join , KBA , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , Bug Filed

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP ONE Support launchpad (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.