If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Custom format number

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-26-06, 03:48
vinodtr vinodtr is offline
Registered User
 
Join Date: Dec 2006
Posts: 8
Custom format number

Hi guys,

i need to do something like this in DB2 and oracle. I have a String which actually is a number(upto 2 decimal places) converted to string. i need to format then number according to the delimiter i have.

eg1: number is 1234567890. i need to format like
1,234,567,890
eg2 123456789.09 -> 123,456,789.09


is there any built in function or a UDF which can accomplish this task ?
Reply With Quote
  #2 (permalink)  
Old 12-26-06, 08:14
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
No. There is no built in function. You will need to write your own UDF.

Andy
Reply With Quote
  #3 (permalink)  
Old 12-26-06, 23:06
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Well, since DB2 doesn't really _display_ numbers, but only _retrieves_ them, the question doesn't make a lot of sense. It will depend on what you use to display your numbers. For example, printf() can do it for you if you use C, or Java's NumberFormat.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On