简体   繁体   English

如何使用 map 更新 jooq?

[英]How can I upadate with jooq using map?

I want to update a table of ORACLE using other table data.我想使用其他表数据更新 ORACLE 表。 I tried putting the data into map and setting them with jooq.The format of the data is not problem but it doesn't work.我尝试将数据放入 map 并使用 jooq 设置它们。数据的格式没有问题,但它不起作用。 Summary Code is here.摘要代码在这里。

Map <String, Object> testMap = dbDataMap

DSL.update(table)
   .set(testMap)
   .where(condition)
   .execute();

Or I tried或者我试过

Map <String, Object> testMap = dbDataMap

DSL.update(table)
   .set(DSL.row(testMap.keySet(),(RowN)testMap.values())
   .where(condition)
   .execute();

The second approach should work like this:第二种方法应该像这样工作:

DSL.update(table)
   .set(DSL.row(testMap.keySet()), DSL.row(testMap.values())
   .where(condition)
   .execute();

Use DSL.row() for both keys and values to set.使用DSL.row()来设置键和值。

DSL.update(table)
   .set(DSL.row(testMap.keySet()), DSL.row(testMap.values())
   .where(condition)
   .execute();

You will found more details in official doc您将在官方文档中找到更多详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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