WebSphere Message Broker, Version 8.0.0.7 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

See information about the latest product version

EXISTS function

The EXISTS function returns a Boolean value to indicate whether a list contains at least one element (that is, whether the list exists).

Syntax

Read syntax diagramSkip visual syntax diagram
>>-EXISTS--(--ListExpression--)--------------------------------><

If the list specified by ListExpression contains one or more elements, EXISTS returns TRUE. If the list contains no elements, EXISTS returns FALSE.

ListExpression is any expression that returns a list. All the following expressions, for example, return a list:
  • A LIST constructor
  • A field reference with the [] array indicator
  • Some SELECT expressions (not all return a list)

If you want to know only whether a list contains at least one elements or none, EXISTS executes more quickly than an expression involving the CARDINALITY function (for example, CARDINALITY(ListExpression ) <> 0).

A typical use of this function is to determine whether a field exists.

Examples

-- Determine whether the F1 array exists in the message. Note that the [ ]
-- are required
DECLARE Field1Exists BOOLEAN EXISTS(OutputRoot.XMLNS.Data.Source.F1[]);
-- Determine whether the F1 array contains an element with the value 'F12'.
-- Again note that the [ ] are required
DECLARE Field1F12Exists BOOLEAN 
  EXISTS(SELECT F.* FROM OutputRoot.XMLNS.Data.Source.F1[] AS F where F = 'F12');
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2016Copyright IBM Corporation 1999, 2016.

        
        Last updated:
        
        Last updated: 2016-05-23 14:47:12


Reference topicReference topic | Version 8.0.0.7 | ak05535_