User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Oracle section within the Web Development category of DaniWeb, a massive community of 426,517 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,081 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Oracle advertiser: Programming Forums
Views: 783 | Replies: 1
Reply
Join Date: Jul 2008
Posts: 1
Reputation: tanta is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tanta tanta is offline Offline
Newbie Poster

Get all the months that have 31 days

  #1  
Jul 23rd, 2008
Hi,
I am a junior dev. and I need help on some select statements on a Oracle db.
First I needed to get all the months of the year in 'MON' format and I did it like this:

  1. SELECT DISTINCT TO_CHAR(dt,'MON') MONTH
  2. FROM ( SELECT TRUNC(SYSDATE,'y')-1+ROWNUM dt
  3. FROM all_objects
  4. WHERE ROWNUM <= 366)
  5. ORDER BY TO_DATE( MONTH, 'MON' )

Now, I need another statements to get only the month that have 31 days, then 30 days the leap year.

I cannot create strings that have the names like JANFEBMAR.. and then compare because we use this in a multilingual environment.

Any help would be appreciate it.
Last edited by peter_budo : Jul 23rd, 2008 at 7:11 pm. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 295
Reputation: tesuji is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 41
tesuji tesuji is offline Offline
Posting Whiz in Training

Re: Get all the months that have 31 days

  #2  
Jul 25th, 2008
Hi,

you may try:

  1. SELECT * FROM yourtable WHERE TO_CHAR(your_date, 'MM') IN ('01', '03',... ,'12')

krs,
tesu
Last edited by peter_budo : Jul 26th, 2008 at 4:11 pm. Reason: Keep It Organized - please use [code] tags
Information is moving—you know, nightly news is one way, of course, but it's also moving through the blogosphere and through the Internets. I promise you I will listen to what has been said here, even though I wasn't here. Ann and I will carry out this equivocal message to the world. I'm the master of low expectations.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Oracle Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Oracle Forum

All times are GMT -4. The time now is 6:12 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC