Home » SQL & PL/SQL » SQL & PL/SQL » Enquiries on searching date using Between function 'merged 3)
Enquiries on searching date using Between function 'merged 3) [message #396254] Sun, 05 April 2009 23:01 Go to next message
setsuna
Messages: 32
Registered: November 2008
Member
Hi there,

I had some enquiries refarding thest 2 statement. When I key in the following statment.

SELECT target_date FROM table_1
WHERE target_date
BETWEEN to_date(sysdate,'dd/mm/yyyy')-5
AND to_date(sysdate,'dd/mm/yyyy')-3

no rows selected -- is displayed

However, when I use the next following statement.

SELECT target_date FROM table_1
WHERE target_date
BETWEEN to_date(sysdate,'dd-mm-yy')-5
AND to_date(sysdate,'dd-mm-yy')-3

I am able to retrieve the target_date. May I know why is this so?

Rgds
Setsuna
Re: Enquiries on searching date using Between function [message #396257 is a reply to message #396254] Sun, 05 April 2009 23:06 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Please, please, please Read & Follow Posting Guidelines above.
Go to the section labeled "Practice" & do as directed.


Post DDL for tables.
Post DML for test data.

Post expected/desired results.
Re: Enquiries on searching date using Between function 'merged 3) [message #396268 is a reply to message #396254] Sun, 05 April 2009 23:44 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
SYSDATE is a date, TO_DATE purpose is to convert STRINGS to date, so TO_DATE on a date is wrong.

Regards
Michel
Re: Enquiries on searching date using Between function 'merged 3) [message #396277 is a reply to message #396254] Mon, 06 April 2009 00:13 Go to previous messageGo to next message
setsuna
Messages: 32
Registered: November 2008
Member
Sorry about that... There is some problem with my internet connection which causes me to multi post this topic. sorry for the trouble caused Embarassed
Re: Enquiries on searching date using Between function 'merged 3) [message #396279 is a reply to message #396254] Mon, 06 April 2009 00:41 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
So why did you not follow Posting Guidelines?

http://www.orafaq.com/forum/t/88153/0/
Please, please, please Read & Follow Posting Guidelines above.
Previous Topic: dynamic update of columns based on rows of other columns
Next Topic: Trigger is not working
Goto Forum:
  


Current Time: Mon Feb 10 11:55:18 CST 2025