Oracle remainder function - Search
Open links in new tab
  1. To find the remainder of a division operation in Oracle SQL, you can use the REMAINDER function. This function returns the remainder of n2 divided by n1.

    Example

    SELECT REMAINDER(15, 4) AS remainder FROM dual;

    This query will return 3 as the remainder when 15 is divided by 4.

    Using REMAINDER Function

    The REMAINDER function takes two arguments and returns the remainder of the division. The syntax is:

    REMAINDER(n2, n1)

    Example with Table Data

    Consider a table named float_point_demo with columns bin_float and bin_double. To find the remainder of dividing bin_float by bin_double, you can use:

    SELECT bin_float, bin_double, REMAINDER(bin_float, bin_double) AS remainder
    FROM float_point_demo;

    This will return the remainder for each row in the table.

    Important Considerations

    • If n1 = 0, Oracle returns an error if the arguments are of type NUMBER.

    • If n2 / n1 equals x.5, then N is the nearest even integer.

    • The sign of the remainder is the same as the sign of n2 if it is a floating-point number.

    Using these functions allows you to efficiently calculate remainders in your Oracle SQL queries.

    Feedback
    Kizdar net | Kizdar net | Кыздар Нет
  1. Some results have been removed