Home » SQL & PL/SQL » SQL & PL/SQL » Searching by dates (9i and 10g)
Searching by dates [message #295166] Mon, 21 January 2008 09:52 Go to next message
Messages: 37
Registered: February 2007
Hi there.

I am new to SQL (well not new just not very bright).

But I wanted to know what was the standard way to search for a date? Should the format be in YYYY-MM-DD should I use - to separate values? Should I put a ' at the start and end of each date i.e. '01/01/2007'. i.e. would this line work?

SELECT * FROM table_name WHERE my_date = '2007-01-01';

[Updated on: Mon, 21 January 2008 09:54]

Report message to a moderator

Re: Searching by dates [message #295169 is a reply to message #295166] Mon, 21 January 2008 10:04 Go to previous messageGo to next message
Michel Cadot
Messages: 64475
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The standard is to use TO_DATE function.

Re: Searching by dates [message #295201 is a reply to message #295166] Mon, 21 January 2008 12:18 Go to previous message
Messages: 4692
Registered: February 2005
Location: East Coast USA
Senior Member
And be aware that a DATE column has a time component to it.
Previous Topic: getting different COUNT with insert and dbms_output
Next Topic: Row as input to a procedure.
Goto Forum:

Current Time: Mon Feb 27 07:40:53 CST 2017

Total time taken to generate the page: 0.10303 seconds