How to Fetch Sequence Values with jOOQ

A lot of RDBMS support standard SQL sequences of some form. The standard SQL syntax to create a sequence is: CREATE SEQUENCE s; The following is how you could fetch a value from this sequence, using jOOQ, assuming you're using the code generator: // import static com.example.generated.Sequences.*; System.out.println(ctx.fetchValue(S.nextval())); The sequence expression translates to a variety … Continue reading How to Fetch Sequence Values with jOOQ

How to Fetch All Current Identity Values in Oracle

Oracle 12c has introduced the useful SQL standard IDENTITY feature, which is essentially just syntax sugar for binding a sequence to a column default. We can use it like this: create table t1 (col1 number generated always as identity); create table t2 (col2 number generated always as identity); insert into t1 values (default); insert into … Continue reading How to Fetch All Current Identity Values in Oracle