Home » SQL & PL/SQL » SQL & PL/SQL » Date Functions (Oracle 10g2)
Date Functions [message #571896] Mon, 03 December 2012 10:32 Go to next message
mjm22
Messages: 46
Registered: January 2010
Location: Singapore
Member
Hi All,

Trying to understand how Oracle DATE works and how it differs to TO_DATE in the below manner...

SELECT DATE '2012-10-25' FROM DUAL;

SELECT TO_DATE('2012-10-25','YYYY-MM-DD') FROM DUAL;


I've had a look through the Oracle Docs but can't find much on this. Basically I want to know how safe the first option is and if it does the same as the second.

Also, where does DATE get the Format String from (NLS setting?). Can it be employed to compare a literal with a date that has a TIME portion set to something other than 12:00:00?

Thanks

Re: Date Functions [message #571897 is a reply to message #571896] Mon, 03 December 2012 10:37 Go to previous messageGo to next message
BlackSwan
Messages: 22845
Registered: January 2009
Senior Member
when all else fails Read The Fine Manual

http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements003.htm#BABGIGCJ
Re: Date Functions [message #571910 is a reply to message #571897] Mon, 03 December 2012 18:07 Go to previous message
mjm22
Messages: 46
Registered: January 2010
Location: Singapore
Member
Thanks Blackswan, that is the document I couldn't find on Oracle Docs earlier today.

Regards

Mike
Previous Topic: Initialize a variable with a whole array
Next Topic: Help with writing a query to multiply columns
Goto Forum:
  


Current Time: Thu Oct 02 08:48:26 CDT 2014

Total time taken to generate the page: 0.24745 seconds