So its a bug
Wilfried Eigl, November 07, 2025 - 4:28 am UTC
Thanks for your response.
The data is created by a GPS device. Of course we can replace all ".0" values with null.
I just wanted to be sure that the problem is the database and not my stupidity.
November 07, 2025 - 10:17 am UTC
Yeah, it's not right.
Do you need to use German NLS settings for these queries? They work if you use a period for the decimal separator instead of a comma for the session-level NLS_NUMERIC_CHARACTERS.
Wrong expectation, I think
mathguy, November 08, 2025 - 5:24 am UTC
XML has no intrinsic concept of "number", it only deals with strings. So, it shouldn't be sensitive to numeric character settings. You are not referencing a schema that would somehow indicate that the content of ele tags should be numeric. The values are just strings of characters - the fact that we may view them as numbers is irrelevant. And you are extracting the values as VARCHAR2 - so there should be no implicit conversion anywhere. The output should look exactly like the input. The 342.0 is actually the only correct one in your output! There is no reason why, in text (strings of characters), the period should become a comma.
This is exactly how the whole thing (data creation plus query) works in Oracle 12 and 19 (12.2.0.1 and 19.3.0.0.0 respectively). That is, even with numeric characters set to "decimal comma" and "period as group separator", the query returns the strings exactly as they were input - there is no conversion of 340.8 to 340,8. The period remains a period, as it should. These are strings, not numbers!
I am able to reproduce exactly the behavior you reported on Oracle 23.6.0.24.10, after I change the numeric characters to "decimal comma" and "period separator". This is, then, a bug INTRODUCED in version 23, it did not exist in earlier versions.
If you check what is stored in the table (without the XMLTABLE call), you will see that the translation of period to comma has already happened. The bug is in the storing of XML data, not in the query. Which, in particular, means that you couldn't even extract the values, convert them to numbers, and then back to strings - conversion to number will fail even if you give explicit NLS_NUMERIC_CHARACTERS arguments, because the inputs sometimes have decimal point and sometimes decimal comma!
Finally, if you use a WITH clause to provide the data on the fly (instead of storing it), the query will work correctly even in Oracle 23, returning the strings UNCHANGED. The bug is not introduced in the XMLTYPE constructor, but rather in some weird processing while XML data is being stored.
November 13, 2025 - 2:54 pm UTC
Good points mathguy
So its a bug
A reader, November 15, 2025 - 8:33 am UTC
with alter session set nls_numeric_characters='.,'; everything is fine.