<value> up to the nearest multiple based on the specified precision or decimal place. Optionally, you can specify a second parameter to determine which decimal place the value should be rounded up to.
Alias: CEILING
Syntax
Parameters
Return Type
Remarks
When the input is of typeNUMERIC, CEIL throws an overflow error if the result of CEIL exceeds the defined precision and scale limits of the return data type.
The following code example calculates the nearest whole number larger than 99.99 and specifies that the output should contain a total of 4 digits, with only 2 digits reserved for the decimal part.
Returns an OVERFLOW ERROR because CEIL returns 100.00, which exceeds the NUMERIC(4,2) data type’s limit of 2 digits before the decimal point, and 100 requires 3 digits.
Examples
The following example returns the nearest whole number larger than2.5549900:
Rows: 1Execution time: 7.50ms
213.1549, and returns a result of type NUMERIC(20,4), which allows for a total of 20 digits, with 4 values allowed after the decimal point:
Rows: 1Execution time: 7.55ms
2.5549900 up to the second decimal place.
It returns 2.56 because the second parameter 2 specifies rounding to the second digit after the decimal, which corresponds to the hundredths place.
Rows: 1Execution time: 5.36ms
1998 that is a multiple of 1000.
It returns 2000 because the second parameter -3 specifies rounding to the third digit before the decimal point, which corresponds to the thousands place.
Rows: 1Execution time: 5.55ms