Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Gisung
Advisor
Advisor

1. Problem

-   MERGE or UPSERT statement is throwing below error in IQ.


    [SQL]

merge into gjang(id, name)
using gjang1 on gjang1.id = gjang.id
    when not matched
        then insert(id, name)
            values(gjang1.id, gjang1.name)
    when matched
        then update set
        gjang.name = gjang1.name,
        gjang.id = gjang1.id

    [Error]

  E,1,-134,Feature 'MERGE INTO <remote_or_iq_table>' not implemented

2. Reproduction Steps


- Here are steps to reproduce.


1) create tables


create table gjang(id int, name char(10));
create table gjang1(id int, name char(10));


2) Execute Merge statement


merge into gjang(id, name)
using gjang1 on gjang1.id = gjang.id
    when not matched
        then insert(id, name)
            values(gjang1.id, gjang1.name)
    when matched
        then update set
        gjang.name = gjang1.name,
        gjang.id = gjang1.id;

3. Solutions

- A Merge statement is included in latest ASE version.

( http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36272.1570/html/commands/... )

But IQ does not support MERGE/UPSERT yet.

So It can be implemented with insert / update statement.

Ex)

If condition1= true
then
     update statement
else
     insert statement
end if;

HTH

Gi-Sung Jang