New versions: Dev (3.16) | Latest (3.15) | 3.14 | 3.13 | 3.12

WHILE statement

Applies to ❌ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

One of the most commonly used loop types is the WHILE statement, which in its procedural form works just like a Java while statement with slightly different syntax.

Procedural dialects may or may not use the LOOP keyword to delimite the loop body, just as with the previous LOOP statement. The jOOQ API always uses it for DSL design reasons. For example, combining the WHILE loop with the variable assignment statement:

-- PL/SQL syntax
WHILE i <= 10 
  INSERT INTO t (col) VALUES (i);
// All dialects
Variable<Integer> i = var("i", INTEGER);

Notice that while is a reserved keyword in the Java language, so the jOOQ API cannot use it as a method name. We've suffixed such conflicts with an underscore: while_().


Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo