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, HANA, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB CALL log('message') -- FIREBIRD, INFORMIX EXECUTE PROCEDURE log('message') -- ORACLE BEGIN log('message'); END; -- SQLDATAWAREHOUSE, SQLSERVER EXEC log 'message' -- ACCESS, ASE, AURORA_MYSQL, AURORA_POSTGRES, COCKROACHDB, DERBY, DUCKDB, EXASOL, H2, MEMSQL, REDSHIFT, SNOWFLAKE, -- SQLITE, SYBASE, TERADATA, TRINO, VERTICA /* UNSUPPORTED */
(These are currently generated with jOOQ 3.19, see #10141), or translate your own on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!