Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use oracle merge statement using Mybatis?

I couldn't see any mapper(mybatis-3-mapper.dtd) where I can call a merge statement in mybatis.

I saw tags for update, insert, delete and SQL

Anyone please suggest how to use oracle merge statement in Mybatis.

like image 365
MukeshKoshyM Avatar asked Feb 15 '23 21:02

MukeshKoshyM


1 Answers

Call the merge as below:-

<update id="exceMerge" parameterType="hashmap">
        MERGE INTO USERS U USING DUAL ON (U.PROPERTY_NAME=#{prop_name}) 
        WHEN MATCHED THEN 
        UPDATE SET U.PROPERTYVALUE=#{prop_value}, U.MESSAGE=#{message,javaType=String,jdbcType=CLOB}
        WHEN NOT MATCHED THEN 
        INSERT(PROPERTY_NAME, PROPERTYVALUE, MESSAGE) VALUES (#{prop_name},#{prop_value},#{message,javaType=String,jdbcType=CLOB})
</update>
like image 177
dinesh028 Avatar answered Feb 17 '23 11:02

dinesh028