简体   繁体   中英

oracle sql multiple new rows merge in to a table

I need to insert new rows into an oracle(12c) SQL table only if they don't exists using java code It is possible that there will be more then 100 rows to check and insert

ideally I would like to have one merge statement with multiple inserts something like this:

MERGE INTO some_table t
USING(???)
ON(???)
WHEN MATCHED THEN UPDATE ???
WHEN NOT MATCHED THEN INSERT (t.id, t.val)
     value("some_id","some_data")
      ...
      ...
      ...

but I have trouble with syntax and i can't find any examples for this case ether

I would like to know:

  1. if this even possible
  2. if yes, is it the correct way to go or there is a better solution
  3. what should be the syntax(some example will be great)
  4. if it not possible than what is the correct way.

thanks for help

遵循OldProgrammer的建议,我将创建临时表,在其中插入新数据,并且将在两个表之间合并

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM