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/commands84.htm )

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

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply