Page 1 of 1

Rounding to 4 decimal places

Posted: Thu Apr 04, 2013 3:30 pm
by cdp
I've got a requirement where I need to round a decimal (Length 19, Scale 7) value to the 4th decimal.

In SQL, the example function and result will look like:

select ROUND(26.086464,4) -> result is 26.086500

I've had a look at previous posts and the Developer's Guide, but I can't see how the CEIL, FLOOR, round_inf, DecimalToDecimal(Number,Rounding) function can be of any use as it only caters for decimal length of 10 and a scale of 2.

Any idea how I can round to the 4th decimal place as done by the SQL above?

Posted: Thu Apr 04, 2013 4:07 pm
by jwiles
Have you tried any of those options to see if they work for you?

Why do you believe that the rounding type caters to only 10,2 decimals? That's a rather limiting definition.

Regards,

Posted: Thu Apr 04, 2013 4:25 pm
by jneasy
Have you seen the following?

viewtopic.php?p=338081

Make sure you have scale of the column set to your desired value, i.e. 4.


Joseph Neasy.

Posted: Thu Apr 04, 2013 4:45 pm
by cdp
Argh, somehow I thought that the examples in Developer Guide, which was using a scale of 2, would only round to the 2nd decimal place no matter what.

Just by making the target field a decimal (19,4) and using the round_inf function it rounds it correctly.

Thanks for your help guys...