Converting number in words
Hi,
I want to convert number in words and get the output through a query.
For example :if the value in row is 1311 then I want the query to return it like one thousand three hundreds and eleven.
Any help is highly appreciated.
Cheers
It could be better indeed, scope is larger, but problem with 0 still exists.
SQL> select to_char(to_date(0,'J'), 'JSP') as converted_form from dual;
select to_char(to_date(0,'J'), 'JSP') as converted_form from dual
ERROR at line 1:
ORA-01854: julian date must be between 1 and 5373484
SQL> Better to build function as showed by Tom Kyte in the link given earlier.
Nicolas.
Similar Messages
-
Function to convert number to word format.
Dear Friends,
Could you please help me with a code that will take 'sum of all values of a column' as input parameter & return its value in word format.
Number can be negative , it can/can't contain digits after decimal.
i have two ways but it won't work when my no. becomes negative
Moreover i want that it should work on both type of data, numbers without decimal & number with decimal.
that is what i possess:
1)
function CF_1FORMULA return char is
num1 number;
p_number number;
type myArray is table of varchar2(255);
l_str myArray := myArray( '',
' thousand ', ' million ',
' billion ', ' trillion ',
' quadrillion ', ' quintillion ',
' sextillion ', ' septillion ',
' octillion ', ' nonillion ',
' decillion ', ' undecillion ',
' duodecillion ' );
l_num varchar2(50);
l_return varchar2(4000);
begin
num1:=:my_mumber;
p_number:=num1;
l_num:=trunc( p_number );
for i in 1 .. l_str.count
loop
exit when l_num is null;
if ( to_number(substr(l_num, length(l_num)-2, 3)) <> 0 )
then
l_return := to_char(
to_date(
substr(l_num, length(l_num)-2, 3),
'J' ),
'Jsp' ) || l_str(i) || l_return||'Rupees';
end if;
l_num := substr( l_num, 1, length(l_num)-3 );
end loop;
return l_return;
end;
and
2)
select to_char(to_date(floor(1234.99),'J'),'Jsp')||' Rupees and '||to_char(to_date((1234.99-(floor(1234.99)))*100,'J'),'Jsp')||' Paise' from dual;
kindly help me.
Thanks & Regards
VishnuCommon question.
But you will have realised that already if you'd bothered to search the forum...
http://forums.oracle.com/forums/search.jspa?threadID=&q=number+to+word&objID=f75&dateRange=all&userID=&numResults=30 -
is there a way in numbers to convert numbers to words,
for example"2300" to"two thousand and three hundred".Here is a spreadsheet I made to doe this:
for Numbers 2.x:
https://www.dropbox.com/s/naooc39djpvn2kk/ValueToText.numbers?dl=0
for Numbers 3.x:
https://www.dropbox.com/sh/wz5ejppkbd924mu/AADXJLJ3brHqJL9ts4iq_Kn1a?dl=0
And a command line application with an Applescript:
https://www.dropbox.com/s/ajlqxwqbaew5e4m/NumWriterWithScript.zip?dl=0
See this thread for additional information:
Return text value of a number -
Convert number to words - eg: 1 should come as "first"
Hi,
Is there any function module which would convert numbers to words in a particular format.
for eg: if input is 2, output should be "second".
if input is twenty, output should be "twentieth".
and likewise...
Thanks in advance,
VishnuHi,
Check this program.
DATA : gv_words TYPE spell.
DATA : n TYPE i.
DATA : BEGIN OF itab OCCURS 0,
split(100),
END OF itab.
PARAMETERS : a TYPE i.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = a
IMPORTING
in_words = gv_words.
WRITE: gv_words-word.
SPLIT gv_words-word AT space INTO TABLE itab.
DESCRIBE TABLE itab LINES n.
READ TABLE itab INDEX n.
PERFORM change_num.
CLEAR: gv_words.
LOOP AT itab.
IF sy-tabix EQ 1.
CONCATENATE gv_words-word itab-split INTO gv_words-word.
ELSE.
CONCATENATE gv_words-word itab-split INTO gv_words-word
SEPARATED BY space.
ENDIF.
ENDLOOP.
WRITE: gv_words-word.
*& Form change_num
* text
* --> p1 text
* <-- p2 text
FORM change_num .
IF itab-split CS 'ONE'.
REPLACE 'ONE' IN itab-split WITH 'FIRST'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'TWO'.
REPLACE 'TWO' IN itab-split WITH 'SECOND'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'THREE'.
REPLACE 'THREE' IN itab-split WITH 'THIRD'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'FOUR'.
REPLACE 'FOUR' IN itab-split WITH 'FOURTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'FIVE'.
REPLACE 'FIVE' IN itab-split WITH 'FIFTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'SIX'.
REPLACE 'SIX' IN itab-split WITH 'SIXTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'SEVEN'.
REPLACE 'SEVEN' IN itab-split WITH 'SEVENTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'EIGHT'.
REPLACE 'EIGHT' IN itab-split WITH 'EIGHTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'NINE'.
REPLACE 'NINE' IN itab-split WITH 'NINTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'TEN'.
REPLACE 'TEN' IN itab-split WITH 'TENTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'ELEVEN'.
REPLACE 'ELEVEN' IN itab-split WITH 'ELEVENTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'TWELVE'.
REPLACE 'TWELVE' IN itab-split WITH 'TWELFTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'TEEN'.
REPLACE 'TEEN' IN itab-split WITH 'TEENTH'.
MODIFY itab INDEX n.
ELSEIF itab-split CS 'TY'.
REPLACE 'TY' IN itab-split WITH 'TIETH'.
MODIFY itab INDEX n.
ELSE. "IF itab-split CS 'D'.
CONCATENATE itab-split 'TH' INTO itab-split.
MODIFY itab INDEX n.
ENDIF.
ENDFORM. " change_num
Your requirement is definitley solved with above program
Regards,
Bhupal -
Converting Number into words while Display
Hello Sir,
I am working on Project System.
I am getting Field MAT_PSPNR(Valuated Sales Order Stock WBS Element) in MSEG Table.
In table the Corresponding field stored in Numbers while Display its converted into Some other Content Please Explain Me ?.
REPORT zdemo LINE-SIZE 600.
tables: mseg.
select-options: so_mblnr for mseg-mblnr. " Document No
start-of-selection.
select mat_pspnr from mseg into mseg-mat_pspnr " Valuated Sales Order Stock WBS Element
where mblnr in so_mblnr.
check sy-subrc = 0.
write:/01 mseg-mat_pspnr.
endselect.
Table Stored value for MAT_PSPNR = 00000293
Report Display: WSP/RAM/02/03.
Kindly Explain how the Contents has been changed ?.
Regards,
Venkat.Hi Venkat,
please check the Domain of the field you are trying to display .
it will have a conversion routine.
for field MAT_PSPNR domain is PS_POSNR
In the domain definition tab you will have a conversion routine .
because of this conversion routine your data is represented in internal format in the table and external format when displayed.
please read conversion routine documentation.
regards, -
Error in converting number to words
I use this query
select (to_char(to_date('46000','J'), 'Jsp'))||' Only' from dual;It is working fine
but when I use this query
select (to_char(to_date('.46','J'), 'Jsp'))||' Only' from dual;
showing the error.
ORA-01858 a non-numeric character was found where a .......hoek wrote:
Hi Solomon,
Thanks much for commenting and elaborating.
2. As we all know there is no such thing as year zero.As we all can see, Kame's example is using a string, so I just made up a 'zero' when there's no value present before the decimal sign.Not sure what you mean. I was talking about year 0, not about zero. So to reiterate, you can not use J/JSP format to spell out numbers between 1721058 and 1721423. And since you started talking about 0, your code will not handle 0 as fractional part:
SQL> with t as ( -- generating some sample data:
2 select '5.0' str from dual
3 )
4 --
5 -- Actual query:
6 --
7 select case
8 when instr(str,'.') > 0
9 then nvl(to_char(to_date(to_number(substr(str, 1, instr(str,'.')-1)),'J'), 'Jsp'), 'Zero')||chr(32)
10 else to_char(to_date(to_number(substr(str, 1, instr(str,'.')-1)),'J'), 'Jsp')
11 end
12 || case
13 when instr(str,'.') > 0
14 then 'point '
15 else null
16 end
17 || to_char(to_date(to_number(substr(str, instr(str,'.')+1)),'J'), 'Jsp')
18 || ' Only' str
19 from t;
|| to_char(to_date(to_number(substr(str, instr(str,'.')+1)),'J'), 'Jsp')
ERROR at line 17:
ORA-01854: julian date must be between 1 and 5373484
SQL> SY. -
How to convert Number to words In PLD
Dear Expert,
I have view all thread related same..but not getting by PLD...
the amount field i want in Indian format that can be placed on cheque/check ?
also i add an external data on that PLD now question is that in filed properties ->content -> procedure name ?
can any one say what that procedure name ? and what u gv ?
also tell me step for PLD
please dont send me that begin script link..tell me other way because as per me it will not work with PLD and if i am wrong then tell me.....
Thankshi kevin,
In Procedure name u need to link .dll file,Dll files can be created using C++ Programming,
External data is actually field to print secured images like company logo,Higher official signatures which
can be tampered when u saved it on computer.
Hope it clarifies.
Jeyakanthan -
Number to Word Convert Function
Dear All,
Plz anybody have function name which can convert NUMBER to WORD.
example: 1213 to One Thousand Two Hundred Thirteen
thanks,
RPrp,
Pls. use below FM...
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = amouno
CURRENCY = 'USD'
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
Check
http://www.sap-img.com/fu001.htm
(OR)
Also you can use FM HR_IN_CHG_INR_WRDS.
report ztest02.
data: words(50) type c.
call function 'HR_IN_CHG_INR_WRDS'
exporting
amt_in_num = '100000'
importing
amt_in_words = words.
write:/ words.
Pls. Reward if useful -
i work on release 11i application and converts some reports to run with xml publisher
i want to convert a total field that exist in po report to words it seems to convert number into words isthat possible i tried to make this in oracle reports and it run successfully but there is a problem when converting that report to run with xml publisher .
any help will be approtiated.Use ap_amount_utilities_pkg.ap_convert_number
E.g.
SQL> select ap_amount_utilities_pkg.ap_convert_number(trunc(12345678)) from dual;
AP_AMOUNT_UTILITIES_PKG.AP_CONVERT_NUMBER(TRUNC(12345678))
Twelve million three hundred forty-five thousand six hundred seventy-eight
Gareth -
Problem in converting number to character
Hi All,
In my report there is number field called <?LINE_TOT_AMOUNT?>. In the next line i want to display that amount in words. I tried using
<?xdofx:to_char(LINE_TOT_AMOUNT)?>
but the output is same as the <?LINE_TOT_AMOUNT?>. Can any one help in solving this?look at TO_CHAR (number)
if LINE_TOT_AMOUNT is number then to_char(LINE_TOT_AMOUNT) in string
it's not display that amount in words
it's only format row
if you wnat to convert number to words
plz see Re: Conversion of number to word -
AOA ALL
Dear i want to convert a numeric value for eg:'1000' into words that is 'ONE THOUSAND' in a report.does any body knows a method or function for that available in developer or any other way...
do tell me
thxHi,
See the link
converting number to words(100==one hundred)
Provided a function to convert number to words
Thanks,
Oracle Reports Team -
Any FM to convert amount to words?
Hi friends,
Is there any function module available to convert amount to words?
Regards,
Lijo JosephRefer:
Re: I want Function Name which converts number to words
Regards,
Subramanian V. -
I need to get the number of words of pdf files. I usually convert them into word files to get the word count. Some pdf files are protected and can't be converted into word files. Is there another way to get the number of words of these protected pdf files? I use adobe professional XI Pro.
Scroll through and read the answers available in the thread below. You may find the information helpful.
Trying to write Javascript code to get word count
Be well... -
I cannot convert pdf to word even thuogh i have subscribed to the service, please advise. Invoice Number 0646799448.pdf
Hi gregorr22536759,
I've checked your account, and it appears that there was a payment processing error. Please Contact Customer Care so that an agent can help you resolve that.
Best,
Sara -
How do I make the images look clear in PDF when converted from MS Word?
Hi
When I convert an MS Word-2010 file (which contains images also) to PDF through Acrobat X Pro, some images which are of bigger size do not look very clear. Is there any workaround for this problem? Please reply. It's quite urgent.
ThanksIn my experience (not necessarily the best), I find it best to rescale image copies with a graphics package before importing into WORD or whatever. Resize and then set the resolution to about 600 dpi before you import. The issue of using the clipboard appears to be an issue with WORD 2007 and such. I clipped a 300 dpi image into my technical word processor and then back to a graphic editor and all was preserved. I did the same with WORD 2007 and everything got messed up and the resultant image looked terrible. In fact, in WORD I got the same result if I imported the picture or clipped it from my graphics package. So it appears there are some strange issues with WORD itself.
I am not trying to make any claims here, but just making an observation. The original image was at 300dpi. WORD also changed the 8-bit B&W photo to a 24-bit photo and reduced the number of pixels from 774 per width to 252 per width about a factor of 3 reduction in pixel resolution when clipped. When I expanded the image size in WORD, then the clip size increased also. When I do the same expansion of the image size in my word processor and then clip back to IrfanView, the original image is retained. My only conclusion is that OFFICE 2007 plays around with graphics and it does not seem to make any difference if you clip the image into WORD or import it, WORD still messes around with it. My guess this is just a general MS thing.
Some folks a year or 2 ago got me to looking at nice sunsets in PPT. There were all sorts of issues with creating the PDF (AA8) from the PPT to get a reasonable result. The image obtained from the MS converter seemed to keep the picture nice. The images obtained from PDF Maker and printing to the Adobe PDF printer gave slightly different results and tended to break the image into smaller parts that often left little lines in the picture if you zoomed in. Folks were blaming this on Acrobat and yet using the same version of Acrobat with OFFICE 2003 the sunset came out great.
This post is a bit jumbled, but the jist is that a lot of the graphics issues with WORD files seem to go back to WORD itself and possibly with hooks MS put into OFFICE (OK, no proof on that and probably impossible to prove) to mess up Acrobat conversions. It would be interesting to see if the same result for the PDF is obtained from other converters, or if it is just something that OFFICE 2007 does "nicely" for Acrobat.
Sorry for going off the deep end, but I just have a major annoyance with OFFICE starting with 2007, particularly for things like this. They couldn't get equations right either, just one more thing that they messed up. As far as I am concerned, a lot of the issues stem from MS and not Acrobat.
Just for the heck of it, I ran the PPT picture through Open Office and used both the PDF export and the print to the Adobe PDF printer. Both retained the full image. However, when clipping from OOP to Irfanview, the resolution was 96dpi. The result seemed to be dependent on the zoom. So there are definitely some issues with copy and paste, at least with how some packages handle it.
Maybe you are looking for
-
SAP Installation java error package j2sdk-1_4_2_16-fcs is already installed
Hi All, I need one help. I am trying to install SAP ECC 6.0 in REDHAT Linux 5.0 and Database Oracle 10.2. I have downloaded the below two java files j2sdk-1_4_2_16-linux-i586.bin j2sdk-1_4_2_16-linux-i586-rpm.bin I uncared the file j2sdk-1_4_2_16-lin
-
Order prints from other online sources
I usually order prints online with Costco.com and then pick them up at a nearby store in an hour. If I organize my pictures in Photoshop Elements 4.0, is there a way to upload the ones I want so I can order them at Costco (instead of the preloaded Ko
-
Could someone show me a sample script of how to load several external png images in to a movieclip using a click action. E.g. IMAGE 1 should appear in present_mc when PARI_BTN is clicked IMAGE 2 should appear in present_mc when LOND_BTN is clicked.
-
Hi everyone, Is it possible to draw on visual objects in java 3d. e.g. Could the user draw a shape on a sphere? thanks
-
On iTunes there Ida. System error stating that the program can't start because MSVCR80.dll is missing from my computer.