Home » SQL & PL/SQL » SQL & PL/SQL » Reset Sunday as first start week (11g Enterprise Edition Release 11.1.0.7.0/Linux)
Reset Sunday as first start week [message #614354] Wed, 21 May 2014 02:36 Go to next message
anil_mk
Messages: 146
Registered: August 2006
Location: Bangalore, India
Senior Member

Hi All,

Please let me know how to reset Sunday as first week of year
Below is the query which returns first week of year


select TO_CHAR(to_date('31-Dec-2012','dd-mm-yyyy'), 'IW') as start_week2013,TO_CHAR(to_date('30-Dec-2013','dd-mm-yyyy'), 'IW') as start_week2014 from dual;

start_week2013  start_week2014
---------------------------------
       01           01




Thanks,
Anil MK
Re: Reset Sunday as first start week [message #614356 is a reply to message #614354] Wed, 21 May 2014 02:43 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
anil_mk wrote on Wed, 21 May 2014 13:06
how to reset Sunday as first week of year


What does it mean? Post your expected output.
Re: Reset Sunday as first start week [message #614357 is a reply to message #614356] Wed, 21 May 2014 02:48 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
A day is not equal to a week.
Do you mean you want the first week of the year to start with a Sunday? And if so which one?
Re: Reset Sunday as first start week [message #614359 is a reply to message #614357] Wed, 21 May 2014 02:54 Go to previous messageGo to next message
anil_mk
Messages: 146
Registered: August 2006
Location: Bangalore, India
Senior Member

Thanks for the reply, yes I want to set first week of year to start with Sunday.

Regards,
Anil MK
Re: Reset Sunday as first start week [message #614363 is a reply to message #614359] Wed, 21 May 2014 03:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
to start with Sunday.


Which one? The first Sunday of the year or the last one of previous year?
For 2014 which day it was?

Re: Reset Sunday as first start week [message #614367 is a reply to message #614359] Wed, 21 May 2014 03:45 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
anil_mk wrote on Wed, 21 May 2014 13:24
I want to set first week of year to start with Sunday.


An ISO week always starts on a Monday and ends on a Sunday. NLS_TERRITORY needs to be changed for such requirement. You can do it at session level. Read Calendar Formats
Re: Reset Sunday as first start week [message #614371 is a reply to message #614367] Wed, 21 May 2014 04:06 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

How does this address OP's issue in any way?
He doesn't want ISO week and NLS_TERRITORY does not change the week of year.
You should read the link you posted.

Previous Topic: How to add whitespace as default value using execute immediate?
Next Topic: remove special characters except , - .
Goto Forum:
  


Current Time: Fri Apr 26 02:07:05 CDT 2024