New versions: Dev (3.16) | Latest (3.15)

CALL statement

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

When using CREATE PROCEDURE statements, for greater composability, it is essential to be able to call a procedure from another procedure. This is done using the CALL statement.

// Create a procedure that inserts a log message in a table
Parameter<String> message = in("message", VARCHAR);

create.createProcedure("log")
      .parameters(message)
      .as(insertInto(LOG).columns(LOG.TEXT).values(message))
      .execute();
      
create.createProcedure("some_other_procedure")
      .as(
      // ...
      call("log").args("My first message"),
      // ...
      call("log").args("My second message")
      // ...
      )
      .execute();
      

Feedback

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

The jOOQ Logo