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 > how to format a decimal number...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-05-03, 12:33
angelitoz angelitoz is offline
Registered User
 
Join Date: Nov 2003
Posts: 1
how to format a decimal number...

Hi... i am a desperate newbie... i am trying to insert into a table some decimal values... but....

INSERT INTO TT set xx = (yyy/zzzz)

the field xx has decimal places but the division result has more decimals than it... so i need to format it in the sql, i must do it in the sql statement..

is there any format number function?
Reply With Quote
  #2 (permalink)  
Old 11-05-03, 13:20
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Re: how to format a decimal number...

Quote:
Originally posted by angelitoz
Hi... i am a desperate newbie... i am trying to insert into a table some decimal values... but....

INSERT INTO TT set xx = (yyy/zzzz)

the field xx has decimal places but the division result has more decimals than it... so i need to format it in the sql, i must do it in the sql statement..

is there any format number function?
I don't think formatting will help you here. If the result cannot be represented with the precision of the column you're trying to change then your only solution is to modify the column definition. If you're sure that the result will fit into the column you can try this:

INSERT ... SET xx = DECIMAL(yyy/zzzz, p, s)

where q and s are the precision and the scale of your target column, respecitvely.
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