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.

SIGNAL

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

The standard SQL way to raise exceptions is via the SIGNAL statement, which is supported natively in a few dialects, and can be emulated in some others.

Some example SIGNAL invocations.

begin(signalSQLState("45000")).execute();
begin(signalSQLState("45000").setMessageText("Custom message")).execute();

Dialect support

This example using jOOQ:

signalSQLState("45000").setMessageText("Custom message")

Translates to the following dialect specific expressions:

DB2, HSQLDB, MariaDB, MySQL

SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Custom message'

Hana

SIGNAL SQL_ERROR_CODE '45000' SET MESSAGE_TEXT = 'Custom message'

Postgres, YugabyteDB

RAISE SQLSTATE '45000' USING MESSAGE = 'Custom message'

ASE, Access, Aurora MySQL, Aurora Postgres, BigQuery, ClickHouse, CockroachDB, Derby, DuckDB, Exasol, Firebird, H2, Informix, MemSQL, Oracle, Redshift, SQLDataWarehouse, SQLServer, 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