Written by

Question Minsu Kim · May 25, 2018

Question: ON DUPLICATE KEY UPDATE

Hello glabal masters,

I am trying to develop WAS using Cache and Spring Framework.

The ON DUPLICATE KEY UPDATE is not working.

Source : 

INSERT INTO 
            ocsGUMCHECDINFO (CODE,DODATE,NAME,DAY,PURPOSE,REQUIREMENT,BEFORENOTE,AFTERNOTE,CNT,REPORT,CONSENT,CONTACT)
        VALUES
            (#{code},#{doDate},#{name},#{day},#{purpose},#{requirement},#{beforeNote},#{afterNote},#{cnt},#{report},#{consent},#{contact})
        ON DUPLICATE KEY UPDATE DAY=#{name},PURPOSE=#{day},REQUIREMENT=#{requirement},BEFORENOTE=#{beforeNote},AFTERNOTE=#{afterNote},CNT=#{cnt},REPORT=#{report},CONSENT=#{consent},CONTACT=#{contact}

Is "ON DUPLICATE KEY UPDATE" not working in Cache SQL? Is there any other way if this isn't working?

Thank you

Comments

Eduard Lebedyuk · May 25, 2018

Use INSERT OR UPDATE:

INSERT OR UPDATE INTO  ocsGUMCHECDINFO
(CODE,DODATE,NAME,DAY,PURPOSE,REQUIREMENT,BEFORENOTE,AFTERNOTE,CNT,REPORT,CONSENT,CONTACT)
VALUES (#{code},#{doDate},#{name},#{day},#{purpose},#{requirement},#{beforeNote},#{afterNote},#{cnt},#{report},#{consent},#{contact})
0
Minsu Kim  May 25, 2018 to Eduard Lebedyuk

Thank you so much, Thank you

Is it similar Oracle SQL grammar?

If Is it only Cache SQL, where did you learn about it?

Thank you so much!!

0