terug naar overzicht


Insight insight


Rob van den Berg

+31 6 22 98 69 27


For counting out loud

When a whole number needs conversion to a fully spelled out format, the wellknown J/JSP “tric” is readily found. Well, in case, you didn’t, here it is. No, it has nothing to do with Java Server Pages.


Supply an API for conversion of a numeric (positive integer including nul) value to the spelled number, in the Dutch language.


A database package dutch_number_spelling has been implemented. It offers just one function, named to_char_sp, which accepts a numeric value as input and returns a (Dutch) spelled number as output.rnrnA second (defaulted) parameter is supplied to have some control on a preference having to do with conversion of a specific range of values, which can either be phrased like a multiple of hundreds followed by the remainder ( the default ), or more puristic but less common, as a multiple of thousands followed by the remainder. The package can be found at the end of this blog.


u003cpreu003eSQLu0026gt; select num, dutch_number_spelling.to_char_sp(num) spelled_numrn 2 from ( select level num from dual connect by level u0026lt;= 42 );rnrnNUM SPELLED_NUM rnu002du002du002du002du002du002du002du002du002du002d u002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002du002drn 1 één rn 2 twee rn 3 drie rn 4 vier rn 5 vijf rn 6 zes rn 7 zeven rn 8 acht rn 9 negen rn 10 tien rn 11 elf rn 12 twaalf rn 13 dertien rn 14 veertien rn 15 vijftien rn 16 zestien rn 17 zeventien rn 18 achttien rn 19 negentien rn 20 twintig rn 21 eenentwintig rn 22 tweeëntwintig rn 23 drieëntwintig rn 24 vierentwintig rn 25 vijfentwintig rn 26 zesentwintig rn 27 zevenentwintig rn 28 achtentwintig rn 29 negenentwintig rn 30 dertig rn 31 eenendertig rn 32 tweeëndertig rn 33 drieëndertig rn 34 vierendertig rn 35 vijfendertig rn 36 zesendertig rn 37 zevenendertig rn 38 achtendertig rn 39 negenendertig rn 40 veertig rn 41 eenenveertig rn 42 tweeënveertigrnrn42 rows selected.u003c/preu003ernWell, and some huge numbers too:rnu003cpreu003eexec dbms_output.put_line(dutch_number_spelling.to_char_sp(1969));rnexec dbms_output.put_line(dutch_number_spelling.to_char_sp(1969,’THOUSANDS’));rnexec dbms_output.put_line(dutch_number_spelling.to_char_sp(1e9+1));rnexec dbms_output.put_line(dutch_number_spelling.to_char_sp(1e38-1));rnrnnegentienhonderdnegenenzestigrnrnduizend negenhonderdnegenenzestigrnrnéén miljard éénrnrnnegenennegentig sextiljoen negenhonderdnegenennegentigu003c/preu003ernu003cpreu003equintiljard negenhonderdnegenennegentig quintiljoenu003c/preu003ernu003cpreu003enegenhonderdnegenennegentig quadriljardu003c/preu003e