Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting a number

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,
I am new to db2. I have been using oracle all these time. We have a project which involves db2. I need to know if there is any function which can format a number in a given format (similar to to_char(10000,"999,999.00") in oracle which will give me 10,000.00 as output) in DB2.
Can anyone help me. I would be greatful for the same.
thanks and regards,
V.bhaskar.
 
Hi visitor,

Use the DEC function:

DEC(number,precision,scale) output is decimal

or the CHAR function:

CHAR(number) output depends on input type, but is always a char. T. Blom
Information analist
Shimano Europe
tbl@shimano-eu.com
 
I would recommend using the FLOAT function instead of the DEC function. The DEC function does some rounding and you may lose the numbers after the decimal point.

You can then format using the forms if you are using QMF.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top