I see code from developers using implicit date conversion. I would like a definitive answer to why they should not do this.
SELECT * from dba_objects WHERE Created >= '06-MAR-2012';
|
I see code from developers using implicit date conversion. I would like a definitive answer to why they should not do this.
|
|||||||||||
|
|
Because Allowing implicit conversions means you are at the mercy of location settings. If you can name a business where 11 months is an acceptable margin of error I'll be impressed. |
|||||||||||||||||
|
|
There are problems that will occur if a session with a different date format runs the code. Statement Failure
Bad Data
In this situation because each of the alter/insert statements could be done by different users. They would all be running the same statements, but the resulting dates would be completely different. The insert statements might be buried in a package that is only indirectly being called. Because no error was returned the problem might not be found until much later. SQL Injection
In this situation a malicious individual could alter there sessions date format in such a way as to give them access to data that they would not normally have access to. |
|||||||||||
|
I would say you will not find a definitive answer. Many of the answers already given here are along the lines of, "If localization settings on the server are changed then this query would give unintended results that may not be identified in a timely manner and Bad Things could happen." Fair enough. But most of the applications I've worked on are not fully localized and in these cases I would imagine the case actually is, "If localization settings on the server are changed then many, many Bad Things will happen very quickly before anyone even has a chance to run this query." In other words, failing to fully localize may well be an acceptable risk for an application that was designed to run in only one region. |
|||||||||||||||
|