dbTalk Databases Forums  

return the correct WW value

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss return the correct WW value in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jjjackjill89@gmail.com
 
Posts: n/a

Default return the correct WW value - 10-28-2008 , 07:34 PM






Hi all,

I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

SQL> select to_char(sysdate, 'WW') from dual;

44

my script for serverPerformanceWeekly.

select hostname, to_char(to_date(&date_start, 'YYYYMMDD') , 'YYYY'),
to_char(to_date(&date_start, 'YYYYMMDD') , 'WW'), genesis_port,
instance_name,
api_name, sum(total_time), max(max_time), min(min_time),
(sum(total_time)/sum(count)), sum(count)
from gen_api_performance_daily
where to_char(statistics_date,'YYYYMMDD') between &date_start and
&date_end
group by hostname, to_char(to_date(&date_start, 'YYYYMMDD') ,
'YYYY'), to_char(to_date(&date_start, 'YYYYMMDD') , 'WW'),
genesis_port, instance_name, api_name;

Reply With Quote
  #2  
Old   
Geoff Muldoon
 
Posts: n/a

Default Re: return the correct WW value - 10-28-2008 , 08:01 PM






25c23db0006c (AT) p39g2000hsb (DOT) googlegroups.com>, says...

Quote:
I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

SQL> select to_char(sysdate, 'WW') from dual;

44
On what "sysdate" did you run the above to get that result? On the Monday
after you discovered the "error" or actually on the Sunday? Did you run
the above form a client connection? What's your (client and server)
NLS_TERRITORY setting? Does that setting default the first day of the
week as a Sunday or as a Monday?

Geoff M


Reply With Quote
  #3  
Old   
Geoff Muldoon
 
Posts: n/a

Default Re: return the correct WW value - 10-28-2008 , 08:01 PM



25c23db0006c (AT) p39g2000hsb (DOT) googlegroups.com>, says...

Quote:
I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

SQL> select to_char(sysdate, 'WW') from dual;

44
On what "sysdate" did you run the above to get that result? On the Monday
after you discovered the "error" or actually on the Sunday? Did you run
the above form a client connection? What's your (client and server)
NLS_TERRITORY setting? Does that setting default the first day of the
week as a Sunday or as a Monday?

Geoff M


Reply With Quote
  #4  
Old   
Geoff Muldoon
 
Posts: n/a

Default Re: return the correct WW value - 10-28-2008 , 08:01 PM



25c23db0006c (AT) p39g2000hsb (DOT) googlegroups.com>, says...

Quote:
I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

SQL> select to_char(sysdate, 'WW') from dual;

44
On what "sysdate" did you run the above to get that result? On the Monday
after you discovered the "error" or actually on the Sunday? Did you run
the above form a client connection? What's your (client and server)
NLS_TERRITORY setting? Does that setting default the first day of the
week as a Sunday or as a Monday?

Geoff M


Reply With Quote
  #5  
Old   
Geoff Muldoon
 
Posts: n/a

Default Re: return the correct WW value - 10-28-2008 , 08:01 PM



25c23db0006c (AT) p39g2000hsb (DOT) googlegroups.com>, says...

Quote:
I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

SQL> select to_char(sysdate, 'WW') from dual;

44
On what "sysdate" did you run the above to get that result? On the Monday
after you discovered the "error" or actually on the Sunday? Did you run
the above form a client connection? What's your (client and server)
NLS_TERRITORY setting? Does that setting default the first day of the
week as a Sunday or as a Monday?

Geoff M


Reply With Quote
  #6  
Old   
jjjackjill89@gmail.com
 
Posts: n/a

Default Re: return the correct WW value - 10-28-2008 , 08:14 PM



On Oct 29, 10:01*am, Geoff Muldoon <geoff.muld... (AT) trap (DOT) gmail.com>
wrote:
Quote:
25c23db00... (AT) p39g2000hsb (DOT) googlegroups.com>, *says...



I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. *It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. *See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

*SQL> select to_char(sysdate, 'WW') from dual;

44

On what "sysdate" did you run the above to get that result? *On the Monday
after you discovered the "error" or actually on the Sunday? *Did you run
the above form a client connection? *What's your (client and server)
NLS_TERRITORY setting? *Does that setting default the first day of the
week as a Sunday or as a Monday?

Geoff M
I'm trying to research how to return the correct WW value (week starts
on a Sunday). have you encountered this before in SQL?


Reply With Quote
  #7  
Old   
jjjackjill89@gmail.com
 
Posts: n/a

Default Re: return the correct WW value - 10-28-2008 , 08:14 PM



On Oct 29, 10:01*am, Geoff Muldoon <geoff.muld... (AT) trap (DOT) gmail.com>
wrote:
Quote:
25c23db00... (AT) p39g2000hsb (DOT) googlegroups.com>, *says...



I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. *It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. *See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

*SQL> select to_char(sysdate, 'WW') from dual;

44

On what "sysdate" did you run the above to get that result? *On the Monday
after you discovered the "error" or actually on the Sunday? *Did you run
the above form a client connection? *What's your (client and server)
NLS_TERRITORY setting? *Does that setting default the first day of the
week as a Sunday or as a Monday?

Geoff M
I'm trying to research how to return the correct WW value (week starts
on a Sunday). have you encountered this before in SQL?


Reply With Quote
  #8  
Old   
jjjackjill89@gmail.com
 
Posts: n/a

Default Re: return the correct WW value - 10-28-2008 , 08:14 PM



On Oct 29, 10:01*am, Geoff Muldoon <geoff.muld... (AT) trap (DOT) gmail.com>
wrote:
Quote:
25c23db00... (AT) p39g2000hsb (DOT) googlegroups.com>, *says...



I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. *It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. *See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

*SQL> select to_char(sysdate, 'WW') from dual;

44

On what "sysdate" did you run the above to get that result? *On the Monday
after you discovered the "error" or actually on the Sunday? *Did you run
the above form a client connection? *What's your (client and server)
NLS_TERRITORY setting? *Does that setting default the first day of the
week as a Sunday or as a Monday?

Geoff M
I'm trying to research how to return the correct WW value (week starts
on a Sunday). have you encountered this before in SQL?


Reply With Quote
  #9  
Old   
jjjackjill89@gmail.com
 
Posts: n/a

Default Re: return the correct WW value - 10-28-2008 , 08:14 PM



On Oct 29, 10:01*am, Geoff Muldoon <geoff.muld... (AT) trap (DOT) gmail.com>
wrote:
Quote:
25c23db00... (AT) p39g2000hsb (DOT) googlegroups.com>, *says...



I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. *It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. *See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

*SQL> select to_char(sysdate, 'WW') from dual;

44

On what "sysdate" did you run the above to get that result? *On the Monday
after you discovered the "error" or actually on the Sunday? *Did you run
the above form a client connection? *What's your (client and server)
NLS_TERRITORY setting? *Does that setting default the first day of the
week as a Sunday or as a Monday?

Geoff M
I'm trying to research how to return the correct WW value (week starts
on a Sunday). have you encountered this before in SQL?


Reply With Quote
  #10  
Old   
Geoff Muldoon
 
Posts: n/a

Default Re: return the correct WW value - 10-28-2008 , 09:24 PM



<6b3da48e-93a1-488b-b585-076ef793736c (AT) t65g2000hsf (DOT) googlegroups.com>,
says...
Quote:
On Oct 29, 10:01*am, Geoff Muldoon <geoff.muld... (AT) trap (DOT) gmail.com

I have a problem for retrieving a correct ww. I hit a snag while
testing the serverPerformanceWeekly script. *It seems the
TO_CHAR(<date>,'WW') function is not returning the correct value. *See
sample below for 26-Oct-2008 (last Sunday), 43 was returned instead of
44. How shud i do?

SQL> select to_char(to_date('20081026','YYYYMMDD'),'WW') from
serverPerformanceWeekly;

TO
--
43

*SQL> select to_char(sysdate, 'WW') from dual;

44

On what "sysdate" did you run the above to get that result? *On the Monday
after you discovered the "error" or actually on the Sunday? *Did you run
the above form a client connection? *What's your (client and server)
NLS_TERRITORY setting? *Does that setting default the first day of the
week as a Sunday or as a Monday?

I'm trying to research how to return the correct WW value (week starts
on a Sunday). have you encountered this before in SQL?
Oops, led you up the wrong path there.

I think you're looking for 'IW' (week of year based on ISO standard)
rather than 'WW" (week of year calculated on weeks starting on the day of
the week defined by whatever January 1st was).

Geoff M


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.