2
I’m with the SQL_MODE
of MySQL
as TRADITIONAL in the version is 5.7.18
and according to the documentation this way would make the MySQL
operate in the same way as other banks, for example SQL Server
.
But when I do:
select 651/0;
instead of accusing the division error by zero (Divide by zero error encountered.
) it gives the result as null.
Does anyone know how to solve?
Documentation:
TRADITIONAL
Make Mysql behave like a "Traditional" SQL database system. A simple Description of this mode is "Give an error Instead of a Warning" when inserting an incorrect value into a column. It is one of the special Combination modes Listed at the end of this Section.
Note The INSERT or UPDATE aborts as soon as the error is noticed. This may not be what you want if you are using a nontransactional Storage engine, because data changes made prior to the error may not be Rolled back, Resulting in a "partially done" update.
I think what the questioner wants is for an error to be reported and not to treat NULL improperly returned.
– anonimo
Thank you for signaling the inconsistency. I performed the adjustment to better fit the question raised.
– Leonardo Paim