Home » SQL & PL/SQL » SQL & PL/SQL » Urgent Reply , Date Problem
Urgent Reply , Date Problem [message #8128] Tue, 29 July 2003 04:56 Go to next message
Bhadresh
Messages: 2
Registered: May 2003
Junior Member
Hi Friend,

what i want is that user enter "first date" then user enter "Second Date" and query must return all the date between that two date.

please Reply Fast
Re: Urgent Reply , Date Problem [message #8130 is a reply to message #8128] Tue, 29 July 2003 06:11 Go to previous messageGo to next message
Pawan
Messages: 33
Registered: June 2002
Member
Check This...

Select * from emp where TRunc(date) between '&first date' and '&second_date' ;

Where Date is the Column....
Emp is the Name of the Table...
First and Second Date is Input Date..
Re: Urgent Reply , Date Problem [message #8134 is a reply to message #8128] Tue, 29 July 2003 10:30 Go to previous messageGo to next message
Praveen
Messages: 57
Registered: November 2001
Member
use between operator
for eg.
select * from tt where dt between '&firstdate' and '&seconddate';
Re: Urgent Reply , Date Problem [message #8135 is a reply to message #8128] Tue, 29 July 2003 13:11 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
sql>var date_from varchar2(10)
sql>var date_to   varchar2(10)
sql>exec :date_from := '07/01/2003'; :date_to := '07/04/2003';
 
PL/SQL procedure successfully completed.
 
sql>select to_date(:date_from, 'mm/dd/yyyy') + rownum - 1 the_date
  2    from all_objects
  3   where rownum <= (to_date(:date_to, 'mm/dd/yyyy') - to_date(:date_from, 'mm/dd/yyyy') + 1);
 
THE_DATE
----------
07/01/2003
07/02/2003
07/03/2003
07/04/2003
 
4 rows selected.
Previous Topic: Job Scheduling
Next Topic: Function based index not begin used
Goto Forum:
  


Current Time: Fri Apr 19 22:27:11 CDT 2024