The SINGULAR function returns a BOOLEAN value indicating whether a list contains exactly one element.
If the list specified by ListExpression contains exactly one element, SINGULAR returns TRUE. If the list contains more or fewer elements, SINGULAR returns FALSE.
If you only want to know whether a list contains just one element or some other number, SINGULAR executes more quickly than an expression involving the CARDINALITY function (for example, CARDINALITY(ListExpression ) = 1).
A common use of this function is to determine whether a field is unique.
-- Determine whether there is just one F1 field in the message. -- Note that the [ ] are required DECLARE Field1Unique BOOLEAN SINGULAR(OutputRoot.XMLNS.Data.Source.F1[]);
-- Determine whether there is just one field called F1 with the value 'F12' -- in the message. Again note that the [ ] are required DECLARE Field1F12Unique BOOLEAN SINGULAR(SELECT F.* FROM OutputRoot.XMLNS.Data.Source.F1[] AS F where F = 'F12');