Home » SQL & PL/SQL » SQL & PL/SQL » date
date [message #233847] Fri, 27 April 2007 14:03 Go to next message
durai
Messages: 38
Registered: December 2006
Member
hi,
using the command
select to_date('27-apr-07')-to_date('01-apr-07') from dual;
i am to getting the values as 26
but i want the values excluding sundays
i am able to slove only via pl/sql, is there any direct query to solve this


thanx in advance
Re: date [message #233858 is a reply to message #233847] Fri, 27 April 2007 15:25 Go to previous messageGo to next message
a_developer
Messages: 194
Registered: January 2006
Senior Member

select count(v.mydate + b.lv)
  from (select to_date('01-apr-07') - 1 mydate from dual) v,
       (select level lv
          from dual
        connect by level <=
                   (select (to_date('27-apr-07') + 1) - to_date('01-apr-07')
                      from dual)) b
 where to_char(v.mydate + b.lv, 'DY') != 'SUN'
Re: date [message #233859 is a reply to message #233847] Fri, 27 April 2007 15:31 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Have a look at the thread "Counting the number of business days between 2 dates" on AskTom.

Regards
Michel
Re: date [message #233889 is a reply to message #233859] Sat, 28 April 2007 00:03 Go to previous messageGo to next message
a_developer
Messages: 194
Registered: January 2006
Senior Member
that's really much simpler!
Re: date [message #233890 is a reply to message #233859] Sat, 28 April 2007 00:04 Go to previous message
a_developer
Messages: 194
Registered: January 2006
Senior Member
that's really much simpler!
Previous Topic: how to send a mail using PL/SQL procedure
Next Topic: last wednesday in month
Goto Forum:
  


Current Time: Sun Dec 11 00:27:33 CST 2016

Total time taken to generate the page: 0.11882 seconds