Hi Everyone,
I'm trying to understand why a simple behavior is not giving any good result.
Scenario is the following, using MOD in Oracle, and % in SQL Server, to emulate the ‘modulo’ function.
However, doing some testing, Oracle results in 15 as the output value in this case:
Oracle query: SELECT MOD((TO_NUMBER('99999999')), 23 + 1) FROM DUAL;
Oracle result: 15
and following the same example on SQL Server gives another result, where this is the one that is expected to have:
SQL Server query : SELECT CAST('99999999' AS NUMERIC) % 23 + 1
SQL Server result: 2
Can someone help me to understand, why the behavior for this function in Oracle and SQL Server is responding different:
https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/MOD.html#GUID-E12A3928-2C50-45B0-B8C3-82432C751B8C
https://learn.microsoft.com/en-us/sql/t-sql/language-elements/modulo-transact-sql?view=sql-server-ver16
Best regards,
user-ryofn