Home » SQL & PL/SQL » SQL & PL/SQL » DATE
DATE [message #213892] Fri, 12 January 2007 12:48 Go to next message
pradkuamr
Messages: 29
Registered: November 2006
Junior Member
Hi Friends

I am having a date column which is in the range from 01/01/1998 and 01/01/2011

Now I would like to select the data only from 01/01/1998 to 01/01/1999

I tried using
select * from Table
where Date between ('01/01/1998') and ('01/01/1999')

Its saying not avalid month

Any suggestions plz
Re: DATE [message #213895 is a reply to message #213892] Fri, 12 January 2007 12:55 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
>('01/01/1998') and ('01/01/1999')
The above are NOT dates. They are text strings.
Use TO_DATE function.
Re: DATE [message #213897 is a reply to message #213895] Fri, 12 January 2007 12:56 Go to previous messageGo to next message
pradkuamr
Messages: 29
Registered: November 2006
Junior Member
I used
TO_DATE('01/01/1998') AND TO_DATE('01/01/1999')

Its saying not a valid month
Re: DATE [message #213899 is a reply to message #213892] Fri, 12 January 2007 13:01 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
It appears you are unwilling or incapable of reading the fine SQL Reference manual to learn the correct syntax for TO_DATE.
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#sthref408
Re: DATE [message #213901 is a reply to message #213892] Fri, 12 January 2007 13:20 Go to previous message
pradkuamr
Messages: 29
Registered: November 2006
Junior Member
Thanks. I solved my problem now
Previous Topic: Want to select date from timestamp
Next Topic: INSERT INTO
Goto Forum:
  


Current Time: Fri Dec 02 18:36:20 CST 2016

Total time taken to generate the page: 0.73991 seconds