Home » SQL & PL/SQL » SQL & PL/SQL » select between date
select between date [message #306114] Wed, 12 March 2008 19:37 Go to next message
caprikar
Messages: 226
Registered: March 2007
Senior Member
Hi,
I have a table MAP_RECORD with a column create_date with data type DATE and I want to select all the records with create_date value between march-01-2007 and march-02-2007. Can anyone tell me how to write a quer for that?
Thanks
Re: select between date [message #306115 is a reply to message #306114] Wed, 12 March 2008 19:47 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
And this is an EXPERT question ?

Please notice the header of this section "Not an EXPERT? Post in the NEWBIES forum, NOT here". Moving to NEWBIES section.

By the way...what have you tried in regards to the query?

[Updated on: Wed, 12 March 2008 19:48]

Report message to a moderator

Re: select between date [message #306135 is a reply to message #306114] Thu, 13 March 2008 00:59 Go to previous messageGo to next message
rameshuddaraju
Messages: 69
Registered: June 2005
Location: India
Member


Use between .. and .. Sql operator

SQL>select * from MAP_RECORD where create_date between
to_date('march-01-2007','month-dd-yyyy') and to_date('march-02-2007','month-dd-yyyy')

OR

if oracle default date format(dd-mon-yy) is not changed then you can use the following query also

SQL>select * from MAP_RECORD where create_date between '01-mar-07' and '02-mar-07'

Re: select between date [message #306145 is a reply to message #306135] Thu, 13 March 2008 01:15 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
if oracle default date format(dd-mon-yy) is not changed then you can use the following query also

NEVER rely on implicit conversion.

Regards
Michel
Re: select between date [message #306257 is a reply to message #306135] Thu, 13 March 2008 08:32 Go to previous messageGo to next message
joy_division
Messages: 4643
Registered: February 2005
Location: East Coast USA
Senior Member
rameshuddaraju wrote on Thu, 13 March 2008 01:59


OR

if oracle default date format(dd-mon-yy) is not changed then you can use the following query also

SQL>select * from MAP_RECORD where create_date between '01-mar-07' and '02-mar-07'




Why would you give such bad advice as such?
Re: select between date [message #306266 is a reply to message #306135] Thu, 13 March 2008 09:10 Go to previous message
pablolee
Messages: 2836
Registered: May 2007
Location: Scotland
Senior Member
Also, please learn to format your posts correctly (once you have learned how to correctly handle dates)
Previous Topic: referential integrity
Next Topic: Quit from procedure.
Goto Forum:
  


Current Time: Fri Dec 09 09:47:00 CST 2016

Total time taken to generate the page: 0.17201 seconds