SET CURRENT DECFLOAT ROUNDING MODE statement
The SET CURRENT DECFLOAT ROUNDING MODE statement verifies that the specified rounding mode is the value that is currently set for the CURRENT DECFLOAT ROUNDING MODE special register.
Invocation
This statement can be embedded in an application program or issued through the use of dynamic SQL statements. It is an executable statement that can be dynamically prepared.
Authorization
None required.
Syntax
Description
- ROUND_CEILING
- Round the value toward positive infinity. If all of the discarded digits are zero or if the sign is negative, the result is unchanged (except for the removal of the discarded digits). Otherwise, the result coefficient is incremented by 1.
- ROUND_DOWN
- Round the value toward 0 (truncation). The discarded digits are ignored.
- ROUND_FLOOR
- Round the value toward negative infinity. If all of the discarded digits are zero or if the sign is positive, the result is unchanged (except for the removal of the discarded digits). Otherwise, the sign is negative and the result coefficient is incremented by 1.
- ROUND_HALF_EVEN
- Round the value to the nearest value. If the values are equidistant, round the value so that the final digit is even. If the discarded digits represent more than half of the value of a number in the next left position, the result coefficient is incremented by 1. If they represent less than half, the result coefficient is not adjusted (that is, the discarded digits are ignored). Otherwise, the result coefficient is unaltered if its rightmost digit is even, or incremented by 1 if its rightmost digit is odd (to make an even digit).
- ROUND_HALF_UP
- Round the value to the nearest value. If the values are equidistant, round the value up. If the discarded digits represent half or more than half of the value of a number in the next left position, the result coefficient is incremented by 1. Otherwise, the discarded digits are ignored.
- string-constant
- A character string constant with a maximum length of 15 bytes, after trailing blanks have been removed. The value must be a left-aligned string that specifies one of the five rounding mode keywords (case insensitive).
- host-variable
- A variable of type CHAR or VARCHAR. The value of the host variable must be a left-aligned string that specifies one of the five rounding mode keywords (case insensitive). The actual length of the contents of host-variable must not be greater than 15 bytes, after trailing blanks have been removed. The value must be padded on the right with blanks when using a fixed-length character host variable. The host variable cannot be set to the null value.
Rules
- The specified rounding mode value must be the same as the value of the CURRENT DECFLOAT ROUNDING MODE special register (SQLSTATE 42815).
Example
The
following statement verifies whether the specified rounding mode value
for the client matches the rounding mode value that is currently set
on the server.
SET CURRENT DECFLOAT ROUNDING MODE = ROUND_CEILING