Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Oracle's "date'[yyyy-mm-dd]'" literal always use the yyyy-mm-dd pattern?

Rephrased, given I use date like so:

date'2010-04-10'

, could the outcome be anything but April 10th 2010 (e.g. October 4th 2010)?

UPDATE I hear what you, and the docs, say. But...

When a batch job runs, with hard-coded date'yyyy-mm-dd':s, it fails for some (non-deterministic) calculations. Running the failing SQL statements in PL/SQL Developer never yields the same, incorrect, value.

First, I ran the same calculations (hundreds of thousands) with the date'' date literals replaced with the to_date('', '') function, and everything worked just fine.

Then, I used NHibernate and its LINQ provider, and replaced the hand-crafted SQL altogether. ... and everything worked just fine... NHibernate produces a '' date literal, with the time part included, BTW.

UPDATE A colleague of mine wrote some code, that can reproduce the error in our environment. He posted his findings (including the code) at Oracle Forums: https://forums.oracle.com/forums/thread.jspa?threadID=2304569&tstart=0

UPDATE Changed the title according to zerkms' answer.

like image 931
Martin R-L Avatar asked Oct 06 '11 11:10

Martin R-L


1 Answers

It is not function, but date literal. And, Yes, it always matches YYYY-MM-DD regardless any oracle settings.

like image 118
zerkms Avatar answered Oct 13 '22 00:10

zerkms