Question

I have came through a query in SQL which will convert number we enter to word format The Query is

select to_char(to_date(&num,'J'),'JSP') from dual;

 TO_CHAR(TO_DATE(678,'J'),'JSP')
 -------------------------------
 SIX HUNDRED SEVENTY-EIGHT

Normally the Julian Date Format gives the number of days added to the Julian date i.e 31-DEC-4712 I am unable to understand how does it convert every number into words.

Help me in understanding what it does actually ...

Was it helpful?

Solution

The to_date function converting the date to julian is not responsible for the result coming up in plain english words. That is the to_char function with 'JSP' as an argument.

I'd explain, but really I think the explanations at the links below can explain better than I could.

Here is a good Ask Tom post that explains Julian Date.

http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1406145293951

And here is another good Ask Tom post that explains how to_char with 'JSP' will give you the number in english words.

http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:18305103094123

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top