ORA-FO-288-C: Are xdt:untypedAtomic values distinct or not distinct?

SECTION 15.1.9 : fn:distinct-values

The first paragraph says "Values that cannot be compared, i.e. the
eq operator is not defined for their types, are considered to be
distinct."  Later it says "Values of type xdt:untypedAtomic are
compared as if they were of type xs:string."  It is not clear
whether one should use the implicit cast from xdt:untypedAtomic
to xs:string before or after applying the rule that values of
incomparable types are always distinct.  Example: given an
untypedAtomic of value "abc" and an xs:string of value "abc",
if we first apply the rule that incomparable values are distinct,
then we conclude that these are two distinct values.  On the
other hand, if we cast the xdt:untypedAtomic, making it into
an xs:string before comparing, then the two values are equal
and only one of them is retained in the result.

If the second interpretation is the correct one, then what is the
type of the "abc" value that is retained in the result?  Is it
xdt:untypedAtomic, is it xs:string, or is it
implementation-dependent?

The simplest resolution to this might be to say that the first
step is to form a sequence derived from the input sequence by
replacing every xdt:untypedAtomic by the result of casting it to
xs:string.  Then throw out duplicates from this derived sequence.


- Steve B.

Received on Tuesday, 17 February 2004 14:06:15 UTC