Home » SQL & PL/SQL » SQL & PL/SQL » Sunday in Month (Oracle9i 9.2.0.1.0, forms 6i)  () 1 Vote
Sunday in Month [message #382370] Thu, 22 January 2009 01:04 Go to next message
sweetkhaliq
Messages: 200
Registered: April 2006
Senior Member

Dear Group Members
i want to make a query to show all sundays in a specific month or in specific two dates.
Please tell me how can i acheive this task.


Thanks and regards

[Updated on: Thu, 22 January 2009 01:11]

Report message to a moderator

Re: Sunday in Month [message #382377 is a reply to message #382370] Thu, 22 January 2009 01:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Already asked and answered several times here.
Please search.

Regards
Michel
Re: Sunday in Month [message #382392 is a reply to message #382377] Thu, 22 January 2009 02:14 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
For a previous, current and next month, all I have to do is to turn my head at 10 o'clock and count red-coloured numbers (i.e. Sundays) in a specific month printed on a wall calendar.

For the rest, well, I have to take a walk (and turn pages) or perform similar non-sophisticated action. If I'd want to involve Oracle, I'd probably follow Michel's suggestion - search the board.
Re: Sunday in Month [message #382434 is a reply to message #382392] Thu, 22 January 2009 05:15 Go to previous messageGo to next message
imran_nu
Messages: 55
Registered: February 2007
Location: Islamabad
Member
here it is

You can find more about this on this forum...

However, i solved the similar problem with the help of littlefoot


select edat,TO_CHAR(EDAT,'DAY')
from (select TO_DATE(:sdat,'DD-MON-YYYY') + LEVEL -1 EDAT from dual 
CONNECT BY LEVEL <= TO_DATE(:EDAT,'DD-MON-YYYY') - TO_DATE(:SDAT,'DD-MON-YYYY') + 1)

WHERE TO_CHAR(EDAT,'DAY') LIKE '%SUNDAY%'



cheers
Re: Sunday in Month [message #382443 is a reply to message #382434] Thu, 22 January 2009 06:02 Go to previous message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Of course instead of using brute force you can be a little smarter and find the arithmetical formula.

Regards
Michel
Previous Topic: REGEXP_LIKE vs LIKE
Next Topic: How to hide tables in a schema?
Goto Forum:
  


Current Time: Fri Feb 07 16:01:25 CST 2025