Available in versions: Dev (3.20)
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.
ARRAY_NONE_MATCH
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The ARRAY_NONE_MATCH
function allows for checking if none of the array elements match a given predicate.
A few SQL dialects, including ClickHouse, DuckDB, and Trino have introduced higher order functions with a lambda syntax to help implement features like this one. jOOQ can map a Java lambda to a SQL lambda, and emulate the feature using standard SQL functionality (using UNNEST and ARRAY_AGG) if the function isn't available.
SELECT array_none_match(ARRAY[1, 2, 2, 3], e -> e > 2)
create.select(arrayNoneMatch(array(1, 2, 2, 3), e -> e.gt(2))).fetch();
The result would look like this:
+------------------+ | array_none_match | +------------------+ | false | +------------------+
Dialect support
This example using jOOQ:
arrayNoneMatch(array(1, 2, 2, 3), e -> e.gt(2))
Translates to the following dialect specific expressions:
Aurora Postgres, CockroachDB, DuckDB, H2, HSQLDB, Postgres
(NOT EXISTS ( SELECT 1 one FROM UNNEST(ARRAY[1, 2, 2, 3]) t (e) WHERE e > 2 ))
BigQuery
(NOT EXISTS ( SELECT 1 one FROM ( SELECT null e FROM UNNEST([STRUCT(1 AS dual)]) AS dual WHERE FALSE UNION ALL SELECT * FROM UNNEST(ARRAY[1, 2, 2, 3]) t ) t WHERE e > 2 ))
Trino
none_match( ARRAY[1, 2, 2, 3], e -> e > 2 )
ASE, Access, Aurora MySQL, ClickHouse, DB2, Derby, Exasol, Firebird, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Redshift, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Sybase, Teradata, Vertica, YugabyteDB
/* UNSUPPORTED */
Generated with jOOQ 3.20. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!