I came across a special restriction on the X number format element used in to_number and in to_char when I was converting hexadecimal numbers to decimal numbers .
It looks like the number format model has a maximum of 63 characters, but I can not find the restriction mentioned in the docs . For instance. mention the maximum model length of the date and time format:
The total length of the date and time format model cannot exceed 22 characters.
C 63 X es:
SQL> select to_number('A', rpad('X', 63, 'X')) from dual; TO_NUMBER('A',RPAD('X',63,'X')) ------------------------------- 10
C 64 X es:
SQL> select to_number('A', rpad('X', 64, 'X')) from dual; select to_number('A', rpad('X', 64, 'X')) from dual * ERROR at line 1: ORA-01481: invalid number format model
I just tried an X format element, as this is relevant for my current task.
Questions:
- Is this a known limitation of the number format model that is simply missing from the documentation?
- How to convert a hexadecimal number with a hexadecimal length of 64 (and longer) to a decimal number?
source share