How to round to n decimal places in Apache Derby JavaDB

Viewed 202

How does one round a given value to n decimal places in Apache Derby using SQL? It should be to the nearest decimal. The SQL round function is not supported in Apache Derby.

1 Answers

Use the following to round the number to two decimal places, you can change the number 2 below to any number of digit you want to round.

cast (@number as decimal(31,2))

Related