It is possible to ask Oracle database the roman number presentation of a number. Just use to_char function with RN format. Just wondering what is the longest roman number.
select rn,len
from (
select rn, max(length(rn))over() mlen, length(rn) len
from (
select to_char(level,'RN') rn from dual connect by level <= 4000
)
)
where mlen=len
;
Well they all are not 15 characters. Need to trim.
select n, rn,len
from (
select n, rn, max(length(rn))over() mlen, length(rn) len
from (
select level n, trim(to_char(level,'RN')) rn from dual connect by level <= 4000
)
)
where mlen=len
;
3888 MMMDCCCLXXXVIII 15
4000 ############### 15
4000 and above are not converted. Also negative numbers and zero are not available. But in between 3888 seems to be "the longest".
No comments:
Post a Comment