jOOQ-插入...选择...返回 [英] jOOQ - INSERT INTO ... SELECT ... RETURNING

查看:61
本文介绍了jOOQ-插入...选择...返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以用jOOQ创建INSERT INTO ... SELECT ... RETURNING语句?如果可以,怎么办?

Is it possible to create a INSERT INTO ... SELECT ... RETURNING statement with jOOQ? If so, how?

这里没有returning功能:

context.insertInto(table, list of fields).select(select statement).returning()

如果确实不存在,有没有明智的解决方法?我无法将INSERT INTO ... SELECT ...表示为INSERT INTO ... VALUES ....有关查询的更多详细信息,请参见问题 jOOQ-用于插入的多字段. >

If this is indeed absent, is there a smart workaround available? I cannot express my INSERT INTO ... SELECT ... as a INSERT INTO ... VALUES .... See question jOOQ - multi-field for insertion for more details about the query.

推荐答案

在jOOQ 3.7通过

That combination of INSERT keywords was indeed not possible until jOOQ 3.7 via #3779.

与此同时,一种解决方法是使用普通的SQL:

A workaround in the meantime would be to use plain SQL:

Result<Record> result = context.fetch("{0} returning *", insertInto(...).select(...));

这篇关于jOOQ-插入...选择...返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆