~/devreads

#date

3 posts

15 Sept 2015

lukaseder 1 min read

I’m seeing people do this all the time. They want to hammer a date or timestamp constant into their SQL query, and the only function they know is the TO_DATE() or TO_TIMESTAMP() date parsing function: As observed in this Stack Overflow question, for instance: Date parsing is important only if your date input is really … Continue reading Don’t Format…

sqldateoracletimestamp

25 Feb 2015

lukaseder 1 min read

The Modern SQL Twitter account (by Markus Winand) published a hint about how to extract a date part in SQL: The right way to get a part of a date/time is: EXTRACT(YEAR FROM CURRENT_DATE) = 2015http://t.co/UNLyUoQdVb Retweet to spread the word! — Modern SQL (@ModernSQL) February 24, 2015 Is it true? Yes it is, in … Continue reading How to…

sqldatedate partsextractsql standard

22 Dec 2014

lukaseder 1 min read

We all know that Oracle’s DATE is not really a date as in the SQL standard, or as in all the other databases, or as in java.sql.Date. Oracle’s DATE type is really a TIMESTAMP(0), i.e. a timestamp with a fractional second precision of zero. Most legacy databases actually use DATE precisely for that, to store … Continue reading Are You…

sqlbind variable castingbind variablescastdate