Skip to main content
Scalar function
NULL input returns NULL.

Syntax

Scalar

  • This page describes the signed-integer calling form with a nonzero divisor. Equal integer types are preserved. With different signed integer types, both operands convert to the wider type in this order: TINYINT, SMALLINT, INTEGER, BIGINT.

Arguments

Returns

  • Type: TINYINT, SMALLINT, INTEGER or BIGINT: the wider signed integer input type
  • NULL behavior: NULL input returns NULL.

Properties

Usage notes

  • INTEGER inputs return INTEGER values, even when query tools report a wider type.
  • Equal integer types are preserved. With different signed integer types, both operands convert to the wider type in this order: TINYINT, SMALLINT, INTEGER, BIGINT.
  • Integer inputs return their common signed integer type, even when query tools report DOUBLE.
  • Deterministic: The same inputs and settings produce the same result.

Examples

Typical behavior

Different dividend and divisor signs

With a negative divisor, the adjusted remainder can be negative.

Limitations

  • Use compatible integer inputs and a nonzero divisor.
  • A positive divisor produces a nonnegative result. A negative divisor may produce a negative result.
Last modified on October 15, 2026