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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing decimals in Oracle SQL

Status
Not open for further replies.

Larshg

Programmer
Mar 1, 2001
187
DK
Hi

I want to remove the decimals after the , in an avg calculation.

This is my script
select AVG(PROCESSED)*60
from PREPAID.RATING_REPORT
where BATCH = 600
and STARTDATE > (sysdate -12/24)

The result is something like this 21123,1677018634 I'd like it to be 21123 - that means coutting of the decimals after the ,

Please notice that it should be after the *60 to give the best result.

thanks.

/Larshg
 
This is my script
select TRUNC(AVG(PROCESSED)*60)
from   PREPAID.RATING_REPORT
where  BATCH = 600
and    STARTDATE > (sysdate -12/24)

or Round(AVG(PROCESSED)*60, 0) if I misunderstood I tried to remain child-like, all I acheived was childish.
 
Thanks they both seem to work

Can you tell me the diference? - I can only find round in my SQL Plus guide.

/Lars
 
Truncate always rounds down, round will round up if it is over .5 I tried to remain child-like, all I acheived was childish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top