Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
🚀 Google AI PRO – 18 Months | Rs. 850 Only
lkkolla
Updated:
Today at 4:56 PM
🔒 NordVPN Premium – 3 Months
hrdilshan
Updated:
Thursday at 8:29 PM
🚀 Microsoft Office 365 Pro Plus – Lifetime Access! 🚀
hrdilshan
Updated:
Thursday at 8:28 PM
Linkedin Premium Business / Careere /Sales Navigator - 1/2/3/6/9/12 Months - Reddem Link
hrdilshan
Updated:
Thursday at 8:27 PM
Colombo
YEYE 3 in 1 Instant Coffee Mix 50 Sachet
Romeshka
Updated:
Wednesday at 12:16 AM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Tips & Tricks
Spell a Number in PL/SQL
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="mdee" data-source="post: 5334384" data-attributes="member: 218633"><p><strong>Oracle Function for SpellNumber</strong></p><p></p><p>Here is the script:</p><p> </p><p>--</p><p>FUNCTION F_SpellNumber (</p><p>In_Amt number)</p><p>RETURN CHAR IS</p><p>-- Spell Number a passed in, deimals are converted into digits in 100th</p><p>-- By : mdee</p><p>-- Version : 1.0 11-Feb-2006</p><p>type myArray is table of varchar2(100);</p><p>l_str myArray := myArray( '',' thousand ', ' million ',' billion ',</p><p>' trillion ',' quadrillion ', ' quintillion ',</p><p>' sextillion ', ' septillion ',' octillion ',</p><p>' nonillion ',' decillion ', ' undecillion ',' duodecillion ' );</p><p>l_num varchar2(100) default trunc(In_Amt);</p><p>l_return varchar2(1000);</p><p>l_deci_val varchar2(100);</p><p>begin</p><p>for i in 1 .. l_str.count</p><p>loop</p><p>exit when l_num is null;</p><p>if ( substr(l_num, length(l_num)-2, 3) <> 0 )</p><p>then</p><p>l_return := to_char(to_date(substr(l_num, length(l_num)-2, 3),'J' ),'Jsp' ) || l_str(i) || l_return;</p><p>end if;</p><p>l_num := substr( l_num, 1, length(l_num)-3 );</p><p>end loop;</p><p>l_return := initcap(NVL(l_return,'xx'));</p><p>if instr(In_amt,'.') > 0 then</p><p>l_deci_val := substr(In_Amt,instr(In_Amt,'.')+1,2);</p><p>if length(l_deci_val)= 1 then</p><p>if l_deci_val >=1 and l_deci_val < 10 then</p><p>-- Convert decimal tens with trailing zero</p><p>l_deci_val := l_deci_val * 10;</p><p>end if;</p><p>end if;</p><p>l_return := l_return || ' and '||(l_deci_val)||'/100';</p><p>end if;</p><p>l_return := l_return || ' only.';</p><p>return(l_return);</p><p>END;</p><p> </p><p>--</p><p>Need any help please let me know.</p><p> </p><p>Try this:</p><p> </p><p><span style="font-size: 10px"><span style="color: #0000f0"><span style="color: black">Select</span></span></span><span style="color: black"><span style="font-size: 10px"> F_SpellNumber</span><span style="font-size: 10px">(</span><span style="font-size: 10px">12345678901234567890</span><span style="font-size: 10px">)</span> <span style="font-size: 10px">from</span><span style="font-size: 10px"> dual</span></span></p><p><span style="font-size: 10px"> </span></p><p><span style="font-size: 10px"><span style="color: black">Twelve Quintillion Three Hundred Forty</span></span><span style="color: black"><span style="font-size: 10px">-</span><span style="font-size: 10px">Five Quadrillion Six Hundred Seventy</span><span style="font-size: 10px">-</span><span style="font-size: 10px">Eight Trillion Nine Hundred One Billion Two Hundred Thirty</span><span style="font-size: 10px">-</span><span style="font-size: 10px">Four Million Five Hundred Sixty</span><span style="font-size: 10px">-</span><span style="font-size: 10px">Seven Thousand Eight Hundred Ninety </span><span style="font-size: 10px"><span style="color: #0000f0"><span style="color: black">only.</span></span></span></span></p><p><span style="color: black"><span style="font-size: 10px"><span style="color: #0000f0"> </span></span></span></p><p><span style="color: black"><span style="font-size: 10px"><span style="color: #0000f0"></span></span></span></p></blockquote><p></p>
[QUOTE="mdee, post: 5334384, member: 218633"] [b]Oracle Function for SpellNumber[/b] Here is the script: -- FUNCTION F_SpellNumber ( In_Amt number) RETURN CHAR IS -- Spell Number a passed in, deimals are converted into digits in 100th -- By : mdee -- Version : 1.0 11-Feb-2006 type myArray is table of varchar2(100); l_str myArray := myArray( '',' thousand ', ' million ',' billion ', ' trillion ',' quadrillion ', ' quintillion ', ' sextillion ', ' septillion ',' octillion ', ' nonillion ',' decillion ', ' undecillion ',' duodecillion ' ); l_num varchar2(100) default trunc(In_Amt); l_return varchar2(1000); l_deci_val varchar2(100); begin for i in 1 .. l_str.count loop exit when l_num is null; if ( 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; end if; l_num := substr( l_num, 1, length(l_num)-3 ); end loop; l_return := initcap(NVL(l_return,'xx')); if instr(In_amt,'.') > 0 then l_deci_val := substr(In_Amt,instr(In_Amt,'.')+1,2); if length(l_deci_val)= 1 then if l_deci_val >=1 and l_deci_val < 10 then -- Convert decimal tens with trailing zero l_deci_val := l_deci_val * 10; end if; end if; l_return := l_return || ' and '||(l_deci_val)||'/100'; end if; l_return := l_return || ' only.'; return(l_return); END; -- Need any help please let me know. Try this: [SIZE=2][COLOR=#0000f0][COLOR=black]Select[/COLOR][/COLOR][/SIZE][COLOR=black][SIZE=2] F_SpellNumber[/SIZE][SIZE=2]([/SIZE][SIZE=2]12345678901234567890[/SIZE][SIZE=2])[/SIZE][SIZE=2] [/SIZE][SIZE=2]from[/SIZE][SIZE=2] dual[/SIZE][/COLOR] [SIZE=2][COLOR=black] [/COLOR] [COLOR=black]Twelve Quintillion Three Hundred Forty[/COLOR][/SIZE][COLOR=black][SIZE=2]-[/SIZE][SIZE=2]Five Quadrillion Six Hundred Seventy[/SIZE][SIZE=2]-[/SIZE][SIZE=2]Eight Trillion Nine Hundred One Billion Two Hundred Thirty[/SIZE][SIZE=2]-[/SIZE][SIZE=2]Four Million Five Hundred Sixty[/SIZE][SIZE=2]-[/SIZE][SIZE=2]Seven Thousand Eight Hundred Ninety [/SIZE][SIZE=2][COLOR=#0000f0][COLOR=black]only.[/COLOR][/COLOR][/SIZE][/COLOR] [COLOR=black][SIZE=2][COLOR=#0000f0] [/COLOR][/SIZE][/COLOR] [/QUOTE]
Insert quotes…
Verification
Haya warak paha keeyada? (haya wadi kireema paha)
Post reply
Top
Bottom