12332kc
12332kc

Reputation: 91

Is it possible to dynamically construct jOOQ VALUES() table?

https://www.jooq.org/doc/3.14/manual/sql-building/table-expressions/values/

It's great that jOOQ supports the VALUES() table constructor, but it looks like the rows cannot be dynamically constructed. I have a list of rows that I would like to dynamically pass into VALUES(), is this possible with jOOQ?

Example: array of (1,2,3,4,5) and would like to construct VALUES(row(1), row(2) ... row(5)) from the array.

Upvotes: 2

Views: 568

Answers (1)

Simon Martinelli
Simon Martinelli

Reputation: 36223

You can pass an array to the values() method.

So simply iterate over your array and create a row per element, add this to an array and finally pass the array with the rows to the values method.

Upvotes: 2

Related Questions