EXISTS function in Amazon QLDB - Amazon Quantum Ledger Database (Amazon QLDB)

EXISTS function in Amazon QLDB

In Amazon QLDB, given a PartiQL value, use the EXISTS function to return TRUE if the value is a non-empty collection. Otherwise, this function returns FALSE. If the input to EXISTS is not a container, the result is FALSE.

The EXISTS function doesn't propagate NULL and MISSING.

Syntax

EXISTS ( value )

Arguments

value

The field name or expression that the function evaluates. This parameter can be any of the supported Data types.

Return type

bool

Examples

EXISTS(`[]`) -- false (empty list) EXISTS(`[1, 2, 3]`) -- true (non-empty list) EXISTS(`[missing]`) -- true (non-empty list) EXISTS(`{}`) -- false (empty struct) EXISTS(`{ a: 1 }`) -- true (non-empty struct) EXISTS(`()`) -- false (empty s-expression) EXISTS(`(+ 1 2)`) -- true (non-empty s-expression) EXISTS(1) -- false EXISTS(`2017T`) -- false EXISTS(null) -- false EXISTS(missing) -- error -- Runnable statements SELECT EXISTS(`[]`) FROM << 0 >> -- false SELECT EXISTS(`[1, 2, 3]`) FROM << 0 >> -- true

Related functions