Are implicit data type conversion rules for COALESCE (a,b,...) the same than for IN (a,b,...)

376 Views Asked by At

I have recently found some difficulties with data conversions of dates within a COALESCE call and finally concluded that the implicit data type conversions rules aplying for COALESCE list elements are the same than the rules used by IN.

From MySQL reference:

If one of the arguments is a TIMESTAMP or DATETIME column and the other argument is a constant, the constant is converted to a timestamp before the comparison is performed. This is done to be more ODBC-friendly. Note that this is not done for the arguments to IN()! To be safe, always use complete datetime, date, or time strings when doing ? comparisons. For example, to achieve best results when using BETWEEN with date or time values, use CAST() to explicitly convert the values to the desired data type.

Is it true that COALESCE and IN share the same type conversion rules? If the answer is yes, I wonder whether those rules are the same for any function with two ore more input parameters.

0

There are 0 best solutions below