Question: ON DUPLICATE KEY UPDATE

Caché, JDBC, SQL

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

  • 0
  • 0
  • 161
  • 2
  • 1

Answers

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})

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!!