ALL_MATCH
Returns 1
if all elements <array_var>
of the specified <array>
when compared to <comparator>
evaluate to 1
(true). match the results of the function provided in the <func>
parameter, otherwise returns 0
.
Syntax
ALL_MATCH(<array_var> -> <array_var>[<comparison>]<expr>, <array_expr>)
Parameter | Description | |
---|---|---|
<array_var> | A Lambda expression array variable that you define to contain elements of arrays found in <array_expr> . For more information, see Manipulating arrays with Lambda functions used to check elements in the array. | |
<comparison> | A comparison operator. For more information, see Comparison operators | |
<expr> | An expression that evaluates to the same element type represented by <array_var> . | |
<array_expr> | An expression that evaluates to an ARRAY data type. |
Example
SELECT
ALL_MATCH(x -> x > 0, [ 1, 2, 3, 9 ]) AS res;
Returns: 1
SELECT
ALL_MATCH(x -> x > 10, [ 1, 2, 3, 9 ]) AS res;
Returns: 0