public class Round extends NumericArgumentFunction
ROUND(n [, scale [, mode]]) — the input rounded to scale decimal places, zero by default.

The scale becomes the RESULT's declared scale as well as the value's, and a NULL scale — or a NULL mode — makes the whole call NULL rather than meaning "no rounding". See RoundedValue.

  • Constructor Details

    • Round

      public Round()
  • Method Details

    • evaluate

      public Object evaluate(List<Object> args)
      Description copied from class: BuiltInFunction
      Computes the function's result over its already-evaluated argument values. A SQL NULL argument arrives as Java null, and returning null makes the SQL result NULL.
      Specified by:
      evaluate in class BuiltInFunction
      Parameters:
      args - the argument values, in call order
      Returns:
      the function's value for these arguments, or null for SQL NULL
    • booleanRejection

      public SemiStructuredRejection booleanRejection(int position)
      ★ The MODE slot is not part of the numeric signature. A BOOLEAN or a temporal value there is not the wrong TYPE but a mode that is not constant — live refuses ROUND(n, 0, TRUE) and ROUND(n, 0, CURRENT_DATE) as "needs to be constant", which the mode rule decides. An ARRAY, OBJECT or BINARY mode is still the wrong type, and so is a BOOLEAN in either numeric slot.
      Overrides:
      booleanRejection in class NumericArgumentFunction
      Parameters:
      position - the zero-based argument position being asked about
      Returns:
      the refusal this position gives a BOOLEAN value; by default none
    • temporalRejection

      public SemiStructuredRejection temporalRejection(int position)
      The same exemption for a DATE, TIME or TIMESTAMP mode — see booleanRejection(int).
      Overrides:
      temporalRejection in class NumericArgumentFunction
      Parameters:
      position - the zero-based argument position being asked about
      Returns:
      the refusal this position gives a temporal value; by default none
    • getMinArgCount

      public int getMinArgCount()
      Description copied from class: BuiltInFunction
      The fewest arguments a call to this function may pass; fewer is an argument-count error.
      Specified by:
      getMinArgCount in class BuiltInFunction
      Returns:
      the minimum accepted argument count
    • getMaxArgCount

      public int getMaxArgCount()
      Description copied from class: BuiltInFunction
      The most arguments a call to this function may pass; Integer.MAX_VALUE marks a variadic function (see BuiltInFunction.isVariadic()).
      Specified by:
      getMaxArgCount in class BuiltInFunction
      Returns:
      the maximum accepted argument count