Hi Lukas,

I can't seem to find the API to do an INSERT RETURNING using a SELECT,
for example:

db.execute(ctx ->
  ctx.insertInto(PRIMARY_ASSIGNMENTS, PRIMARY_ASSIGNMENTS.REGISTRANT,
PRIMARY_ASSIGNMENTS.NUMBER).
      select(
          ctx.select(DSL.val(registrant), ALLOCATIONS.NUMBER.min()).
              from(ALLOCATIONS).
              where(ALLOCATIONS.NUMBER.notIn(
                ctx.select(ASSIGNMENTS.NUMBER).
                    from(ASSIGNMENTS)
              ).and(ALLOCATIONS.REGISTRANT.eq(registrant)))
      ).
      execute()
);

I was poking for some kind of returning() thingy, as you can use on a
InsertValuesStepN.

Or is it more idiomatic to do a plain jane

ctx.insertInto().
values(
  ctx.select().stuff().here()).
returning(
  field().from().stuff()
)

?

Cheers,

Ben

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to