Kbase P136119: Passing NOW to a function or method expecting a DATE or DATETIME parameter fails
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/5/2008 |
|
Status: Verified
SYMPTOM(s):
Passing NOW to a function or method expecting a DATE or DATETIME parameter fails
Passing any DATETIME-TZ value to a DATETIME or DATE parameter fails
Passing a DATETIME value to a DATE parameter fails
Attempting to do one of the above results in compiler error
Parameter <number> in routine '<name>' is not type compatible with the definition of '<name>'. (2749)
FACT(s) (Environment):
OpenEdge 10.x
All Supported Operating Systems
CAUSE:
Enhancement Request# 0000003837
CAUSE:
Parameters for functions and methods are strong-typed, and while they do support implicit casting to a wider datatype (ie. one that holds more data) they do not support implicit casting to a more narrow datatype (where data will most likely be lost), even when the conversions to the more narrow datatype are well defined and documented.
However, for a user-defined function, there is one exception to the above rule. For user-defined functions, the compiler allows an INT64 to be passed to a function expecting an INTEGER. It is possible that the invocation of this user-defined function may succeed at compilation time but fail at runtime based on the size of the data being passed to the user-defined function. This was done to ease the integration of the INT64 data type into existing procedural applications.
This also applies when chaining function calls, the NOW function returns a DATETIME-TZ which will not be cast to a DATETIME or DATE parameter for a function or method automatically.
FIX:
This enhancement has not been implemented at the time of writing.
Workaround:
Explicitly add the conversion to the more narrow datatype.