问题
I am using jdbc to insert or update into a table based on the condition, if the data already exists in the table. I am getting data from an external source. Is it possible to have a single query to perform this task? scenario looks somewhat like this:
if (if row with the data exists){
perform UPDATE
}else{
perform INSERT
}
回答1:
You can use
JSON_TABLE(JsonData,'$' , columns(column1 VARCHAR2(50 CHAR) PATH '$.column1'))
which will convert JSON data into relational view and then use the same in MERGE.
Refer this.
来源:https://stackoverflow.com/questions/60484178/conditionally-update-or-insert-using-single-query-in-oracle-table