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, Snowflake, 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, Databricks, Derby, DuckDB, Exasol, H2, MemSQL, Redshift, SQLite, Sybase, Teradata, Trino, Vertica
/* UNSUPPORTED */
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!