extract the week of the year

Hello

How to extract of the week from the date in the obiee11g functions


Thank you

Syntax: WEEK_OF_YEAR ("calendar". "Date") "

for week:WEEK_OF_YEAR (current_date) courses

Kind regards
Disney

Tags: Business Intelligence

Similar Questions

  • How can I extract the year of a variable?

    Hi all

    I want to extract the year of a parameter.

    I tried the following, I make mistakes.

    When I run the code below,

    SELECT TO_CHAR(:X_PRM_YR_END_DT,'YYYY') FROM dual;

    I got the following error.

    ORA-number 01722:invalid

    When I run the code below,

    SELECT TO_DATE(:X_PRM_YR_END_DT,'YYYY') FROM dual;

    SELECT to_char (TO_DATE (: X_PRM_YR_END_DT, "YYYY")) FROM dual;

    I got the following error.

    ORA-01830: date format end before you convert all of the input string

    When I run the code below,

    SELECT extract (YEAR FROM: X_PRM_YR_END_DT) FROM dual;

    SELECT extract (YEAR FROM 01/11/2013) FROM dual;

    I got the following error.

    ORA-30076: invalid field extracted from source

    How can I extract the year of a variable?

    Help me please

    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production.

    Try this,

     

    SELECT TO_CHAR (to_date (' 01/01/1980 ',' dd/mm/yyyy'), 'YYYY') FROM dual;

  • Function to create dates as well as the week, quarter, and year

    Hi all

    I am trying to write a function that will create automatically with their respective week, quarter, and year dates in different columns.

    For example,.

    Date of the quarter Qtr/Yr/QtrWk week exercise exercise exercise

    415 Q4-WK1352201530/09/2015

    I would like to create a full year for each day of show week quarter Qtr/year/QtrWk, exercise, exercise from 01/10/2015-09 30, 2016.

    Appreciate your help and advice.

    Thank you

    AMan

    Hi AMan,

    can't answer your question with a detailed requirement.

    No doubt a whole year can be created in a SQL statement (CONNECT BY or the recursive subquery factoring) and is not a problem.

    But I would like to ask you the following:

    • How do you get the week number? There might be a different way to look at it (ISO or not, week starting with the Sun, Mon or the first day of the year, etc.)
    • The same question can be applied to the financial week. When it's the first week? 01/10/2015 until 10/07/2015?

    You can have a quick glance at the definition of different week in 'Model of Format of Date' on this page:

    https://docs.Oracle.com/CD/B28359_01/server.111/b28286/sql_elements004.htm

    Check the difference between WW and IW.

    Kind regards.

    Alberto

  • Week of the year (from Monday to Sunday)

    Hi guys,.

    I searched 'Week of the year' and that you have not found a solution to my problem.

    I think that the standard Oracle 'IW' function returns the week of the year beginning January 1.  This year, for example, Monday, January 6 is back as week 1 because on 1 January was Wednesday, therefore, it is in the 1st 7 days of the year.

    Select to_char (to_date(:p_date,'DD/MM/YYYY'), 'IW') wrong_week_no

    , to_char (to_date (: p_date + 2, ' DD/MM/YYYY'), 'IW') correct_week_no

    of the double

    I would like the query to return the week number from Monday to Sunday, so in this case, the 6th should return as number 2 of the week.

    In the query above, by adding 2 to the date gives me the correct week number but won't work for 2015 and 2016.

    Any help would be appreciated.

    I use the Oracle 10 g platform.

    Thank you

    Chris

    Do you mean like this?

    SQL > break the month jump 1
    SQL > set linesize 200
    SQL > set pagesize 2000
    SQL > column month format a20
    SQL > column week format a4
    SQL > with req as (select '& Required_Year_YYYY' year of double)
    2, offset as (select case when to_char (trunc (to_date (yr, 'YYYY'), 'YYYY'), 'IW') in ('52 ', ' 53') then 1 else 0 end as the offset of req)
    3 select lpad (Month, - 20 (20-length (month)) / 2) months.
    4 '('|| semaine ||') ' as the week, "Mo", "You", "We", "Th", "Fr", "Sa", "knew".
    5 of)
    6. Select to_char (dt, 'fmMonth YYYY') month,
    7 case when to_char (dt, 'mm') = '12 ' and to_char (dt, 'iw') = ' 01' and offset = 0 then ' 53 "
    8 when to_char (dt, 'mm') = '12 ' and to_char (dt, 'iw') = '01' and offset = 1 then ' 54'
    9 when to_char (dt, 'mm') = '01' and to_char (dt, 'iw') and ('52', ' 53 ") then"1"
    10 to_char (to_number (to_char (dt, 'iw')) + offset) other end than the week,.
    11 max (decode (to_char(dt,'d'), '1', lpad (to_char (dt, 'GFMD') 2)),) "Mo."
    12 max (decode (to_char(dt,'d'),'2 ', lpad (to_char (dt, 'GFMD'), 2))) "you."
    Max (decode (to_char(dt,'d'),'3 ', lpad (to_char (dt, 'GFMD'), 2))) 13 '' We. ''
    14 max (decode (to_char(dt,'d'),'4 ', lpad (to_char (dt, 'GFMD'), 2))) "Th."
    15 max (decode (to_char(dt,'d'),'5 ', lpad (to_char (dt, 'GFMD'), 2))) "Fr."
    16 max (decode (to_char(dt,'d'),'6 ', lpad (to_char (dt, 'GFMD'), 2))) "his."
    17 max (decode (to_char(dt,'d'),'7 ', lpad (to_char (dt, 'GFMD'), 2))) "Su".
    18 in (select trunc (to_date (req.yr, 'YYYY'), 'y')-1 + rownum dt)
    19 object, req
    20 where rownum<= add_months(trunc(to_date(req.yr,'yyyy'),'y'),12)="" -="" trunc(to_date(req.yr,'yyyy'),'y')="">
    21, offset
    22 group by to_char (dt, 'fmMonth AAAA'), case when to_char (dt, 'mm') = '12 ' and to_char (dt, 'iw') = ' 01' and offset = 0 then ' 53 "
    23 when to_char (dt, 'mm') = '12 ' and to_char (dt, 'iw') = '01' and offset = 1 then ' 54'
    24 when to_char (dt, 'mm') = '01' and to_char (dt, 'iw') and ('52', ' 53 ") then"1"
    25 to_char (to_number (to_char (dt, 'iw')) + offset) to another end
    (26) x
    27 order by to_date (month, "Month YYYY"), to_number (x.week)
    28.
    Enter the value for required_year_yyyy: 2012
    old 1: with req as (select '& Required_Year_YYYY' year of double)
    new 1: with req (select '2012' year of double)

    MONTH WEEK Mo Tu we Th his di ve
    -------------------- ---- -- -- -- -- -- -- --
    January 2012 (1) 1
    (2) 2 3 4 5 6 7 8.
    (3) 9 10 11 12 13 14 15.


    (4) 16 17 18 19 20 21 22.
    (5) 23 24 25 26 27 28 29.
    (6) 30 31.

    February 2012 (6) 1 2 3 4 5
    (7) 6 7 8 9 10 11 12.
    (8) 13 14 15 16 17 18 19.
    (9) 20 21 22 23 24 25 26.
    (10) 27 28 29.

    March 2012 (10) 1 2 3 4
    (11) 5 6 7 8 9 10 11.
    (12) 12 13 14 15 16 17 18.
    (13) 19 20 21 22 23 24 25.
    (14) 26 27 28 29 30 31.

    April 2012 (14) 1
    (15) 2 3 4 5 6 7 8.
    (16) 9 10 11 12 13 14 15.
    (17) 16 17 18 19 20 21 22.
    (18) 23 24 25 26 27 28 29.
    (19) 30

    May 2012 (19) 1 2 3 4 5 6
    (20) 7 8 9 10 11 12 13.
    (21) 14 15 16 17 18 19 20.
    (22) 21 22 23 24 25 26 27.
    (23) 28 29 30 31.

    June 2012 (23) 1 2 3
    (24) 4 5 6 7 8 9 10.
    (25) 11 12 13 14 15 16 17.
    (26) 18 19 20 21 22 23 24.
    (27) 25 26 27 28 29 30.

    July 2012 (27) 1
    (28) 2 3 4 5 6 7 8.
    (29) 9 10 11 12 13 14 15.
    (30) 16 17 18 19 20 21 22.
    (31) 23 24 25 26 27 28 29.
    (32) 30 31.

    August 2012 (32) 1 2 3 4 5
    (33) 6 7 8 9 10 11 12.
    (34) 13 14 15 16 17 18 19.
    (35) 20 21 22 23 24 25 26.
    (36) 27 28 29 30 31.

    September 2012 (36) 1 2
    (37) 3 4 5 6 7 8 9.
    (38) 10 11 12 13 14 15 16.
    (39) 17 18 19 20 21 22 23.
    (40) 24 25 26 27 28 29 30.

    October 2012 (41) 1 2 3 4 5 6 7
    (42) 8 9 10 11 12 13 14.
    (43) 15 16 17 18 19 20 21.
    (44) 22 23 24 25 26 27 28.
    (45) 29 30 31.

    November 2012 (45) 1 2 3 4
    (46) 5 6 7 8 9 10 11.
    (47) 12 13 14 15 16 17 18.
    (48) 19 20 21 22 23 24 25.
    (49) 26 27 28 29 30.

    December 2012 (49) 1 2
    (50) 3 4 5 6 7 8 9.
    (51) 10 11 12 13 14 15 16.
    (52) 17 18 19 20 21 22 23.
    (53) 24 25 26 27 28 29 30.
    (54) 31

    64 selected lines

    I used 2012 for example, because in this case, it has 54 weeks.

    So, here we have 1 January during the week 1, but 2 January's second week, as is Monday, etc.

  • extracting remaning months of the year during the current month

    Hello

    I like allows you to retrieve the other months of the year from the current date.
    Can I do this?

    For example, it is today, July 23, 2012.
    Then, I would like to have:

    August
    September
    October
    November
    December

    Thank you
    Diana

    Hi, Diana,.

    Here's one way:

    SELECT     TO_CHAR ( ADD_MONTHS (SYSDATE, LEVEL)
              , 'Month'
              )    AS month_name
    FROM     dual
    CONNECT BY     LEVEL     <= 12 - EXTRACT (MONTH FROM SYSDATE)
    ;
    

    What output would you want in December?

  • How to extract the first day of the year quarter

    Hello

    How can I write a query to extract the first day in a neighborhood of declaration

    for example: -.

    Q1 starts from April 1 to June 30, second quarter starts from July 1 to September 30, third quarter starts from 1 October to 31 December and the fourth quarter begins from January 1 to March 31.

    How can I recover then the first day of these quarters, regardless of the year. The year can be any year.

    Hello

    don't know exactly what you want, but if you want the first day of a quarter for any given date and then

    select trunc(sysdate,'Q') from dual;
    

    Sysdate obviously could be a valid date.

    André

  • extract the date year

    Hello

    IAM using obiee 11g, hold extract the date year
    CAST (YEAR ("ABC". "DATEADDED") as varchar (4)) "
    so used like that

    But I want as if the year is 11 2011 then only I want y at - it a direct function that does this.

    Thank you

    You can use the right right function (year 2). Will return 11 if the year 2011

  • Extraction of the year

    Hi all

    My Date field is in the MM-DD-YYYY format, and I need to change it for ME-DD-YYYY.

    and how do I extract this date field year there after.

    Thanks in advance,
    Imtiaz.

    You can try this:

    For use of the year:

  • Deriving from the first day of the week ww in the year yyyy

    I need to be able to display the first day of a particular week in addition to the "week of the year" and the year. for example:
    select to_char("ServiceDate",'yyyy-ww') as "Year/Week", sum("Points") as "Points"
    from my_table
    group by to_char("ServiceDate",'yyyy-ww')
    order by to_char("ServiceDate",'yyyy-ww')
    give me the following:
    Year/Week     Points
    2008-33            1                      
    2008-35            1                      
    2008-42            4                      
    2008-43            2                      
    2009-01            1                      
    ...
    and so on. What I would like to add to the dataset is the same day, the first day of the week for this week/year. For example, the first line would look like this:
    Year/Week     1st day of week     Points
    2008-33          08-AUG-2008*         1
    * Or whatever the first day of the week 33 of 2008 is (assuming that "first day of the week" is a Sunday, in my case).

    My brain is on "dim" right now; any help is greatly appreciated.
    Thanks in advance,
    Carl
    select  to_char(trunc("ServiceDate",'ww'),'yyyy-ww') as "Year/Week",
            to_char(trunc("ServiceDate",'ww'),'DD-MON-YYYY') "Week Start Date",
            sum("Points") as "Points"
    from my_table
    group by trunc("ServiceDate",'ww')
    order by trunc("ServiceDate",'ww')
    /
    

    SY.

  • Extract data based on the year and month

    My clients have taken a field TimeStamp DB Oracle and downloaded the access in a TEXT field format.
    Samples: 20060401001348CS

    Everything I'm doing is extracted from the data based on the year and the month. I equal to 200604 *, 200604%. Have also tried to use AS.
    Nothing works. It may just be that dificult. Help, please. Thank you

    Mike

    I'm SO sorry. I have 35 years of Experinece in this area and I have my data (assuming) was all a 200604 date and he was not. The query did work. I'll have more questions and that you do not want to loose credability with this site. Again, I am sorry. Sincere to help thanks.
    Ron

  • How to get the week of the year in American Standard

    Hello

    I know that it might be a repetitive question, but has not found a convincing solution to him in any of the previous threads. I'm looking for a function (user defined, if someone has already written it) go the week of the year, American Standard. i.e., The week should begin on Sunday and end on Saturday (and NOT from Monday to Sunday)

    03/01/2010 - should be the beginning of the 1st week of 2010... 10/01/2010 will be the beginning of the second week and so on
    04/01/2009 - should be the beginning of the 1st week of 2009... 11/01/2009 will be the beginning of the second week and so on.

    Does anyone have a function that takes a date as input and returns back the week of the year in the above format? Any help is greatly appreciated.

    Thank you

    You can add a day to your date in order to manipulate the weeks;

    with t as (
       select to_date('02/01/2010','dd/mm/yyyy') dt from dual union all
       select to_date('03/01/2010','dd/mm/yyyy') from dual union all
       select to_date('09/01/2010','dd/mm/yyyy') from dual union all
       select to_date('10/01/2010','dd/mm/yyyy') from dual)
    select dt, to_char(dt, 'Day') dy, to_char(dt+1, 'iw') wk
    from t;
    
    DT          DY        WK
    ----------- --------- --
    02/01/2010  Saturday  53
    03/01/2010  Sunday    01
    09/01/2010  Saturday  01
    10/01/2010  Sunday    02
    
  • How to group the values according to the weeks of the year?

    Hello

    I have a table with dates and values (I'm simplifying the need for this question)

    I want to group the values (and adding the) according to the 52 weeks of the year. I mean week of consolidation for the week.
    Here the date of each weeks generated during a year, it gives every Monday of each week of the year:
    Select trunc (trunc (sysdate, 'year'), 'iw') +(rownum*7)-7 n of object where rownum < = 53

    What I want to do is to summarize the values in my table and group together them in every week, in that respect. The date of these weeks are generated by the above query.

    For example all values fall into the 1st week of the year will be grouped into this date, all values fall in the 2nd wek will be grouped in this date and so on. If no value is found for a week, then a value of 0 is generated in iorder have a 52 weeks-lines. It's basically a kind of select with "date between... and...". "and group values and that affect the number of the wee, they are relevant.

    Examples of Monday, June 30, 2008, 07/07/2008, 07/14/2008

    Example of values and dates in my table:

    Date value
    30/06/08 9
    07/01/08 9
    07/02/08 9
    07/03/08 9
    07/03/08 9
    07/04/08 6
    07/04/08 6
    07/04/08 9
    07/07/08 9
    07/08/08 9
    29/07/08 9
    29/07/08 6
    30/07/08 9
    07/31/08 9
    07/31/08 9
    07/31/08 9
    08/01/08 9
    08/04/08 5.5
    08/04/08 9
    08/07/08 9
    08/07/08 9
    08/08/08 9
    14/08/08 9
    14/08/08 9
    18/08/08 9
    22/08/08 9
    22/08/08 9
    25/08/08 9
    25/08/08 9
    26/08/08 9
    29/08/08 9
    29/08/08 9
    09/01/08 9
    09/01/08 9
    09/04/08 9
    09/04/08 9
    09/05/08 9
    09/05/08 9
    09/05/08 9
    09/05/08 9
    17/09/08 9

    Result should be something like this:

    Number of the week Date value
    47/1 12/31/2008
    94/2 07/12/2008
    2008-01-14 3, 23
    and so on...
    .....
    73/52 12/22/2008
    60/53 29/12/2008

    I hope I am clear. Thank you for your kind replies.

    Something like that, maybe:

    select trunc(trunc(sysdate,'year'),'iw') +((level-1)*7)  n
    from dual connect by level<=53
    

    (I changed it to sysdate so that the next years will take care of them!)

  • Can extend us the years of no.of to an existing application.

    Peer Hai,

    (1) I use Hyperion11.1.1.3 can extend us the years of no.of to an existing application.

    (2) I know use the Standard calendar, but how can we use custom calendar and the calendar is set manually, what are their purpose.

    How can I create a periodic weekly application. I'm new to HFM can someone explain to me.

    Sorry, let me clarify start menu and file locations for you.

    On the Windows computer with HFM App Server installed:

    Start--> all programs--> Oracle EPM system--> financial management--> Utilities--> year upgrade

    The location of the file should be:

    \EPMSystem11R1\products\FinancialManagement\Utilities\FMChangeNumberOfYearsForApp.exe (or FMChangeNumberOfYearsForApp_x64.exe)

    example: C:\Oracle\Middleware\EPMSystem11R1\products\FinancialManagement\Utilities\FMChangeNumberOfYearsForApp_x64.exe

    If she is not there, maybe the version your have does not include it again? (I have 11.1.2.1) If she is not there, you can:

    a.) log in to the oracle support (support.oracle.com), then find the item of data by another user in this thread
    (b) download the components for HFM App Server to a version that has the utility (i.e. 11.1.2.1) and extract compressed files. [Probably not recommended unless you are comfortable dealing with files from archive, etc.]

  • Thunderbird has suddenly charge only 200 emails on behalf of yahoo of the year 2011 and nothing else. What's wrong? -Due to problems with Yahoo.

    I use Thunderbird to access 3 e-mail accounts. A few days before, all the emails of one of these missing accounts and now Thunderbird does not charge that 200 emails from this account of the year 2011. News, incoming mail does not appear, and I can't know how to extract or import any emails which are newer than 2011.

    What is your email provider?

  • Problem with Photos, a folder with photos of the years just disappeared

    I added a photo to an album this morning and tried to add another photo, a few minutes later, and the entire album had disappeared.

    That's happened?

    Can I get it back?

    His received nearly a hundred photographs of gastropods, I've taken over the years, so his days or weeks of work to sort again.

    And I don't want to do so if it could happen again.

    I closed my Photos and restarted the computer, no luck.

    It cannot be simply disappeared, can it?

    LT

    It would help you to tell us what you have (software and versions) and exactly what you were doing

    According to what you were doing the answer may be to restore your backup from just before events htsi

    LN

  • HP: I need the month and the year of manufacture of the following numbers. Can you please help

    Can you please help me with the manufacturing of the year and the month of the following computers portable

    [Personal information]

    Hello:

    Take a look at the first serial number you posted...

    The 4th character from the left is the year of manufacture.

    In the first case, it is either 2005, 2015 according to the model (that would be obvious based on the hardware of the laptop has, or when you bought).

    The characters of 5th and 6th from the left indicate the week of manufacture.

    If you need to take another look at the first serial number because 3-b is probably a 38 (which means the 38th week of the year).  Like all the others who have two numbers in the 5th and 6th places.

    The 38th week of the year is sometime in September.

Maybe you are looking for