Is-Of-Type Operator
The is-of-type operator checks the sequence type of its input sequence against one or more target sequence types. If the number N of the target types is greater than one, the expression is equivalent to OR-ing N is-of-type expressions, each having one target type.
Example: Fetch the names of the passengers whose baggage tags contain
only numbers and not a
STRING.
SELECT fullname,bag.bagInfo.tagNum
FROM BaggageInfo bag
WHERE bag.bagInfo.tagNum is of type (NUMBER)
Explanation: The tagNum
in the bagInfo
schema is
a STRING data type. But the application could take in a NUMBER value as
tagNum
by mistake. The query captures the passengers for whom the
tagNum
column has only numbers.
Output:
{"fullname":"Raymond Griffin","tagNum":17657806243578}
If you query the
bagInfo
schema for the above
tagNum
as STRING, no rows are
displayed.SELECT * FROM BaggageInfo bag WHERE tagnum = "17657806232501"
0 row returned
You can also fetch the names of the passengers whose baggage tags contain
only
STRING.
SELECT fullname,bag.bagInfo.tagNum
FROM BaggageInfo bag
WHERE bag.bagInfo.tagNum is of type (STRING)