Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

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(val("My first message")),
      // ...
      call("log").args(val("My second message"))
      // ...
      )
      .execute();
      

Dialect support

This example using jOOQ:

call("log").args(val("message"))

Translates to the following dialect specific expressions:

BigQuery, DB2, HSQLDB, Hana, MariaDB, MySQL, Postgres, YugabyteDB

CALL log('message')

Firebird, Informix

EXECUTE PROCEDURE log('message')

Oracle

BEGIN
  log('message');
END;

SQLDataWarehouse, SQLServer

EXEC log 'message'

ASE, Access, Aurora MySQL, Aurora Postgres, ClickHouse, CockroachDB, Derby, DuckDB, Exasol, H2, MemSQL, Redshift, SQLite, Snowflake, Sybase, Teradata, Trino, Vertica

/* UNSUPPORTED */
(Generated with jOOQ 3.20. Translate your own SQL on our website

References to this page

Feedback

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

The jOOQ Logo