Home » SQL & PL/SQL » SQL & PL/SQL » about date
about date [message #226570] Sun, 25 March 2007 04:14 Go to next message
parasuramchekuri
Messages: 32
Registered: March 2007
Location: vishakapatnam
Member
hai all
i have a requirement to select details between twodates, and my requirement is those two dates are equal, the result should display only that day, i ve used between function for this but i did not get result if both dates are equal
pls give me any solution
Thanks in Advance
Ram...
Re: about date [message #226571 is a reply to message #226570] Sun, 25 March 2007 04:18 Go to previous messageGo to next message
Michel Cadot
Messages: 64127
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Do your dates include time?
If yes, what is your requirement when you give 2 dates? Is this between the beginning of each date or between the beginning of the firt (00:00:00) and the end the second date (23:59:59)?
What did you try? Post your query (a simplified query).

Regards
Michel
Re: about date [message #226572 is a reply to message #226571] Sun, 25 March 2007 04:34 Go to previous messageGo to next message
parasuramchekuri
Messages: 32
Registered: March 2007
Location: vishakapatnam
Member
hai
my requirement is
selection of data between two dates, including those two dates
ex
i ve customer details with datesonly,
if i take to date and from date is samedate
Re: about date [message #226573 is a reply to message #226572] Sun, 25 March 2007 04:37 Go to previous messageGo to next message
Michel Cadot
Messages: 64127
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

So if your dates really include only date and not time, then using between should work.
Post the simplified query and exemple that this does not work.
Re: about date [message #226578 is a reply to message #226573] Sun, 25 March 2007 04:59 Go to previous messageGo to next message
parasuramchekuri
Messages: 32
Registered: March 2007
Location: vishakapatnam
Member
AND BILL_DATE BETWEEN TO_DATE('fromdate','DD/MON/YY') AND TO_DATE('todate','DD/MON/YY');
in the above quary we are passing the dates to fromdate and todate
through java.
we are passing the todate:= 25-03-2007 and
from date:= 25-03-2007

but quary doesn't work
no results will be shown
but i ve data corrsponding this date in database
Thanks
Ram

Re: about date [message #226579 is a reply to message #226578] Sun, 25 March 2007 05:11 Go to previous messageGo to next message
Michel Cadot
Messages: 64127
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

1/ Never ever use implicit conversion, always use explictly conversion, your Java program must use to_date function on its date string.

2/ If the dates do not contains a time, the query should work.
If it does not work then the dates also contain time. In this case you have to add time in your query:
"between to_date('25-03-2007 00:00:00','DD-MM-YYYY HH24:MI:SS') and to_date('25-03-2007 23:59:59','DD-MM-YYYY HH24:MI:SS')

Regards
Michel
Re: about date [message #226607 is a reply to message #226578] Sun, 25 March 2007 17:47 Go to previous message
William Robertson
Messages: 1640
Registered: August 2003
Location: London, UK
Senior Member
parasuramchekuri wrote on Sun, 25 March 2007 10:59
AND BILL_DATE BETWEEN TO_DATE('fromdate','DD/MON/YY') AND TO_DATE('todate','DD/MON/YY');
in the above quary we are passing the dates to fromdate and todate
through java.
we are passing the todate:= 25-03-2007 and
from date:= 25-03-2007

What relationship does the format 'DD/MON/YY' have with a value like '25-03-2007'?

Does Java not allow you to pass in DATE values and avoid the conversion?

[Updated on: Sun, 25 March 2007 17:47]

Report message to a moderator

Previous Topic: how to create view using stored procs
Next Topic: Associative array as type
Goto Forum:
  


Current Time: Wed Dec 07 06:44:50 CST 2016

Total time taken to generate the page: 0.10349 seconds