ARRAY_ANY_MATCH
Returns true
if at least one of the elements of a BOOLEAN
array is true
. Otherwise returns false
.
If an optional function parameter is provided, returns true
if the function returns true
for at least one of the elements in the array. Otherwise returns false
.
Alias: ANY_MATCH
Syntax
ARRAY_ANY_MATCH([<function>], <array>)
Parameters
Parameter | Description | Supported input types |
---|---|---|
<function> | A Lambda function used to check elements in the array. | Any Lambda function returning BOOLEAN |
<array> | The array to be matched with the function. | Any array (must be of type BOOLEAN if <function> is not provided) |
Return Types
Returns BOOLEAN
Example
Because there are values in the array greater than 3
, the function returns true
.
SELECT
ARRAY_ANY_MATCH(x -> x > 3, [ 1, 2, 3, 9 ]);
Returns: true
As there is no value 10
in the array, the function returns false
.
SELECT
ARRAY_ANY_MATCH(x -> x = 10, [ 1, 2, 3, 9 ]);
Returns: false