Share jOOQ on Facebook
Share jOOQ on Twitter

All versions: 3.9 | 3.8 | 3.7 | 3.6 | 3.5 | 3.4 | 3.3 | Development versions: 3.10 | Unsupported versions: 3.2 | 3.1 | 3.0 | 2.6 | 2.5

Some SQL access abstractions that are built on top of JDBC, or some that bypass JDBC may support named parameters. jOOQ allows you to give names to your parameters as well, although those names are not rendered to SQL strings by default. Here is an example of how to create named parameters using the org.jooq.Param type:

// Create a query with a named parameter. You can then use that name for accessing the parameter again
Query query1 ="lastName", "Poe")));
Param<?> param1 = query.getParam("lastName");

// Or, keep a reference to the typed parameter in order not to lose the <T> type information:
Param<String> param2 = param("lastName", "Poe");
Query query2 =;

// You can now change the bind value directly on the Param reference:

The org.jooq.Query interface also allows for setting new bind values directly, without accessing the Param type:

Query query1 ="Poe"));
query1.bind(1, "Orwell");

// Or, with named parameters
Query query2 ="lastName", "Poe")));
query2.bind("lastName", "Orwell");

In order to actually render named parameter names in generated SQL, use the DSLContext.renderNamedParams() method:

                 param("lastName", "Poe"))));
-- The named bind variable can be rendered

The jOOQ Logo