|previous : next|
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.
Applies to ❌ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
A trigger can specify a filter, which helps avoid context switching, etc. when the trigger does not need to be fired. This can be achieved with the
WHEN clause, which can access the
NEW pseudo table columns, see also the REFERENCING clause.
create.createTrigger("trg") .beforeInsert() .on(BOOK) .referencingNewAs("n") .forEachRow() .when(BOOK.as("n").TITLE.isNotNull()) .as(insertInto(LOG).columns(LOG.TEXT).values("Row inserted in BOOK")) .execute();
Do you have any feedback about this page? We'd love to hear it!