| | |
Get all the months that have 31 days
Please support our Oracle advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 1
Reputation:
Solved Threads: 0
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:
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.
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:
sql Syntax (Toggle Plain Text)
SELECT DISTINCT TO_CHAR(dt,'MON') MONTH FROM ( SELECT TRUNC(SYSDATE,'y')-1+ROWNUM dt FROM all_objects WHERE ROWNUM <= 366) 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 8:11 pm. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Apr 2008
Posts: 296
Reputation:
Solved Threads: 42
Hi,
you may try:
krs,
tesu
you may try:
sql Syntax (Toggle Plain Text)
SELECT * FROM yourtable WHERE TO_CHAR(your_date, 'MM') IN ('01', '03',... ,'12')
krs,
tesu
Last edited by peter_budo; Jul 26th, 2008 at 5: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.
![]() |
Similar Threads
- convert seconds to minutes, hours, days, months, years, etc. (C)
- Error message when attempting to run program in Windows XP (Windows NT / 2000 / XP)
- array structs, size swap functions, the amount of days between to dates (C++)
- The World's Youngest IBM Certified J2EE Developer. (Java)
- Logic to Convert Days From 1800 to a Date (Month, Day, Year) (C++)
- daniweb down for two or three days. (Geeks' Lounge)
- JoeOneEye- prosearching.com problem (Viruses, Spyware and other Nasties)
- Contest Windows Up Time (Windows NT / 2000 / XP)
- Delete Old Posts? (DaniWeb Community Feedback)
Other Threads in the Oracle Forum
- Previous Thread: Oracle Server Version
- Next Thread: Database driver and provider
| Thread Tools | Search this Thread |
2009predictions acquisition amazon.com bartz bernanke cia citrix cloudcomputing crm database dell economy editor enterprise enterprise2.0 enterprisesoftware federalreserve forbes hp ibm intellipedia internet larryellison layoffs linux loughridge mediawiki michaeljackson microsoft neverland nortel notebooks oil operatingsystem oracle palm rimm saas salesforce sap seagate socialcomputing sql sun sybase technologystocks virtualiron virtualization vmware wiki wikipedia xen yahoo zoho





