How can you convert a number into words using Oracle Sql Query? What I mean by Number to Word is:
Here’s a classy query which will convert number into words.Please see the query below:
If I pass 234 in number, then the output will : two hundred thirty-four
So how the query works? Well here’s why:
If you look into the inner most part of the query to_date(:number,'j') the ‘j’ or J is the Julian Date (January 1, 4713 BC), basically this date is been used for astronomical studies.
So to_date(:number,'j') it take the number represented by number and pretend it is a julian date, convert into a date.
If you pass 3 to number, so it will convert date to 3rd Jan 4713 BC, it means 3 is added to the Julian date.
Now to_char(to_date(:number,'j'),'jsp'), jsp = Now; take that date(to_date(:number,'j')) and spell the julian number it represents
Hope this helps
Related Posts
Fetch Random rows from Database (MySQL, Oracle, MS SQL, PostgreSQL)
Row Data Multiplication in Oracle
Generating Random Data in Oracle
Deleting Duplicate Rows in Oracle
Fast data copy with “Create Table Select From” in PL/SQL
Invisible Indexes in Oracle 11g
Oracle Data Compression