calculation of the years

Please, help me in this query.

In the setting of my report, I need a list that displays years from 2011 (current year). If
I open the report next year, the parameter should have 2011 and 2012 under the list. If I open the report
in the year 2013, the parameter must be 2011, 2012, 2013 in this list and the list is expected to increase each year.

How is it possible that I can go back to using a single SQL query? If it is too complicated to write using
a SQL query, I can write a function to return this value?

Thank you for your time and help

KK

Alexandre Gelin says:
u can try this also

Say if you need from 2011 to 2015

TO_NUMBER (to_char (sysdate, 'yyyy')) SELECT level-1 year from dual connect by level<=>

But it does not work... If you read the original message.

Why offer a solution to a nonexistent problem?

Tags: Database

Similar Questions

  • Calculation of calculation of the year previoius

    Hi all

    I want to calculate previous (year, quarter, month) Calc. How can I do that.

    Thank you
    Barry

    Hi Barry,.

    There are using works of the RPD.

    AGO (measure, level, inteval)

    level is here every year for the previous year
    quarter to quarter
    month for the previous month
    We can even extend to week too.

    Meantime, how much is the desired preliminary values say 1 year type 1 and so on

    Thank you
    Subhash

    Published by: S on July 21, 2011 09:02

  • Calculation of length of Service - splitting of the months in the years

    Hi people,

    I was wondering if someone might have the answer to a small length of Enigma of service employee. I'm currently building a calculation that will calculate the seniority of the employee in years entire worked only. I also need to produce a second calculation to calculate the length of the month service integers worked only, but with the whole years of a month deducted value it.

    For example, if a date of hiring people is calculations on 5 February 2001 the two would return:

    7 years of service
    Length of the train 6 months

    The following calc will generate seniority as a decimalised number:

    MONTHS_BETWEEN (SYSDATE, Hire Date) / 12

    As for my person example I get 7,64 years.

    I need a way around this down in the nearest 1 for all years of service. I can't use the ROUND function because it rounds to the nearest, so when a number is no. 5 or above, it goes round and round only low when the number is n.49 or lower. Grrr.

    My next mission is to work on the months of service based on whats after the decimal. If I could round up the length of the years of service, I think that I could achieve this goal. I just have:

    ROUNDING (((MONTHS_BETWEEN (SYSDATE, Date d'embauche) / 12)-(+ ARRONDI + (MONTHS_BETWEEN (SYSDATE, Date d'embauche) / 12)) * 12))

    ROUNDOWN as my nonexistent function!

    Any opinion on this is greatly appreciated.

    Lloyd

    Use FLOOR() or tronque() instead of ROUND() to round down

  • Summary of the sum of the year or Analytics

    I would like to find a way to summarize some data and do calculations without Hardcoding. Trying to add up the numbers by year and then show the numbers for 4 years and 6 years without Hardcoding if possible. 4 years would be calculated by adding 390 to the cohortterm (390 + 200540 = 200930) 6 years would be calculated by adding the cohortterm (200540 + 590 = 201130) 590.

    The last 2 passes, that I haven't done yet would be a percentage based on Gradyr4 divided by the staff and the other for Gradyr6 divided by membership. If the WPS is too complicated, I can copy the results to excel for this part. Eventually, I'll have to further break down charges according to sex and the membership ethnic, but if all goes well, I can understand it once I know the syntax to make the number.

    BANNER
    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    Example of output based on the query I've built so far using sum and hard coding for one year only. Actual results would show account and not from 0 in the lines of the year displayed below:
    COHORTTERM     HEADCOUNT     GRADYR4     GRADYR6     PCT4Yr  PCT6Yr
    200340          0          0     0
    200440          0          0     0
    200540          600          403     539     (403/600)
    200640          0          0     0
    200740          0          0     0
    SQL
    select cohortterm, 
             sum(case when cohortterm = '200540' then 1 else 0 end) as headcount,
             sum(
                    CASE WHEN cohortterm = '200540' and gradtermban < ''200930' then 1 else 0 end
                    ) as gradyr4,
                    
             sum(
                    CASE WHEN cohortterm = '200540' and gradtermban < '201130' then 1 else 0 end
                    ) as gradyr6
             null as pct4yr, null as pct6yr       
                   
    from cohorts
    where cohortterm between '200340' and '201240'
    and substr(ftpt,1,1) = 'F'
    group by cohortterm
    order by 1

    Based on your code example, here's a guess at what you want. You just need to extract the part of the year, add 4 or 6, then replace with the correct value for the period. Put two bits of information in the same column is also against the theory of database "normal form".

    DROP TABLE T;
    CREATE TABLE T(COHORTTERM VARCHAR2(6), GRADTERMBAN VARCHAR2(6));
    INSERT ALL
    into t values('200304', '200620')
    INTO T VALUES('200304', '200720')
    INTO T VALUES('200304', '200820')
    INTO T VALUES('200304', '200920')
    INTO T VALUES('200404', '200620')
    INTO T VALUES('200404', '200720')
    INTO T VALUES('200404', '200820')
    INTO T VALUES('200404', '200920')
    SELECT NULL FROM DUAL;
    
    SELECT
    COUNT(*) CNT,
    SUM(CASE WHEN GRADTERMBAN < TO_NUMBER(SUBSTR(COHORTTERM,1,4))+4||'03' THEN 1 END) YEAR4,
    sum(case when gradtermban < TO_NUMBER(SUBSTR(COHORTTERM,1,4))+6||'03' then 1 end) year6
    FROM T
    group by cohortterm;
    
           CNT      YEAR4      YEAR6
    ---------- ---------- ----------
             4          2          4
             4          1          3
    
  • 12 months year in comparison to the year and the masking of the current month

    I have a question rearding Web Analytics, but I think it could be more essbase.

    I wrote a report that shows me the following:

    Jan-Feb-Mar-Apr - May - June - July - Aug - Sep - Oct - Nov - Dec
    This year 2012 5 5 5 5 5 5 1
    Year latest 2011 5 5 5 5 5 5 5 5 5 5 5 5

    My problem is that my data are met for all of last year and until July of this year, however I do not want to report of July of this year again, I would only report June, July is not yet closed. How can I tell the system that it's ok to report 12 months last year, but only to the report through June of this year. When I tried to hide June, he hid last years June as well.

    I have a dimension of the year and a period as well as the size of data dimension.

    Any help would be greatly appreciated.

    Thank you

    Paul

    Hi Paul

    It's how works the multidimensionality, I'm afraid that if you have periods in the years in rows and columns, then if you hide a period it will hide all years in your lines.

    According to what you need to your report to look like one option is years battery and periods in the columns, you can then use the skin work for the combination of "This Year" & "Jun".

    Other than that you're watching two calculations on the report or in the underlying database Essbase. Is it only specific reports that you want to or you have a general policy of only including including data for the periods completed / closed?

    If you have versions in your database, then you can create a 'Final' or 'Reports' version, then use a metric to set a flag 1 = report, #Mi = don't report and a calculation, so that your new version contains only data values for periods you want to report. If you do year over year variance rpeorting you could also build the flag to that.

    Hope this helps
    Stuart

  • Age of query optimization in the year

    Hey there,

    I calculate the difference of the year between two dates by doing the following thing:
    TRUNC(MONTHS_BETWEEN(RES.SAMPLE_SAMPLING_DATE,RES.PATIENT_BIRTHDATE)/12)+1
    Do you think I can optimized the query or you know other ways to do the same calculation?

    Kind regards
    Jarod.

    Have you already searched this forum?
    There are many examples...

  • Calculation of the date fields

    Hello

    I have three fields. 2 are formatted with the date field, and the third for the calculation of the difference between 2 date fields.

    For example, Field1 said August 2012, and field 2 said Sep 2012. Is it possible that I can do field 3 dipslay the 1 (month) response?

    Any help would be greatly appreciated.

    Thank you

    Yes, you use the date object JavaScript extract fields of the whole of the year and the month, create a common denominator for the month and year, and do the math.

    The event of calculation for the number of months:

    Delete the result value

    Event.Value = "";

    get field values

    var sStart = this.getField("Date1").value;

    Send var = this.getField("Date2").value;

    process if we have data

    If (sStart! = "" & send!) = "") {}

    convert date objects date strings

    var start = util.scand ("mmm yyyy", sStart);

    oEnd var = util.scand ("mmm yyyy", sending);

    get the full date and month year beginning

    var nStartFullYear = oStart.getFullYear ();

    var nStartMonth = oStart.getMonth ();

    convert data from start of month

    var nStartMonths = (nStartFullYear * 12) + nStartMonth;

    Get the complete year end date and month

    var nEndFullYear = oEnd.getFullYear ();

    var nEndMonth = oEnd.getMonth ();

    convert data from end of month

    var nEndMonths = (nEndFullYear * 12) + nEndMonth;

    do the math

    Event.Value = nEndMonths - nStartMonths;

    } / / end have given

    You will need to adjust the names for the start and end dates.

  • Calculations for the periods of the mother

    Hi all


    I am able to calculate for months and I want to calculate quarter separately...

    When I tried that calculate the option was not put in evidence...

    Hi friends please help me to calculate data for the quarter, semester, year


    Kind regards
    MILIN

    If you do a calculation for a specific our. You must make these account as dynamic calc and write calculation logic in the routine of sub sub dynamic(). The vale will be calculated at the neighbourhood level. This is usually done to report accounts that can be rolled for the period.

    Hope this is useful
    Nick

  • calculate the day of the year using the date.

    Hi all
    Can calculate us the day of the year using the date form? Is this possible? Please help me thanks in advance
    Like this
    30/08/2009-30/08/2010 after calculation - 365


    Sarah

    Published by: SarahSarahSarah on August 30, 2009 12:49 AM

    Sarah.

    : ins1.noday must be a part of number!

    Create a function in forms like this:

    function get_nodays ( f_dtm_start in date,
                          f_dtm_end   in date ) return number is
    begin
    if
      f_dtm_start is null OR
      f_dtm_end is null
    then
      return ( null );
    end if;
    return ( trunc ( f_dtm_start ) - trunc ( f_dtm_end ) );
    exception when others
    then message ( sqlerrm || ' in function get_nodays occured.' );
    return ( null );
    end;
    

    Call this function in the when-validate-point triggers on ins1. INSPERIOD and: ins1.end love

    :ins1.noday := get_nodays ( :ins1.INSPERIOD, :ins1.end );
    

    It is redundant to have the: noday as a cause of part of database
    the value may by calculated every time using the values INSPERIOD and: end.

  • can you help to reset the iPhone 6 +? used of the year and the month. Now, when you update, it asks activation and I can't remember anything! Arouca and verification is in stock

    can you help to reset the iPhone 6 +? used of the year and the month. Now, when you update, it asks activation and I can't remember anything! Arouca and verification is in stock

    To activate you need your Apple ID and password. If you forgot their date on https://iforgot.apple.com.

  • I have a large collection of big slideshows in iPhoto, created over the years with captions from the titles of the photos. How can I keep these slide shows subtitled in Photos?

    I have a large collection of big slideshows in iPhoto, created over the years with captions from the titles of the photos. How can I keep these slide shows subtitled in Photos?

    You can't keep slideshows as captioned photos.  Slide shows get migrated in the form of albums for the Group of photos is maintained.  But Photos don't have the ability to add descriptions to the slide show so that they would have to be manually added to each slide automatically.

    However, a possible solution would be to export every slide show in iPhoto as a Quicktime movie file. Which will keep the titles and descriptions on each slide.  The resulting QT files can be imported into the iPhoto library before migration or photo library after.

  • 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?

  • Count of the number of days in a calendar month according to the year

    Hi all

    On my table, column 1 is the list of months over several years.

    Column 2 is the activity number od each month.

    Column 3 I want an average rate of activity per day during the month, which should be: (C2 / number of days according to C1) %

    Problem: I can't find a fomula give me the number of days, particularly in February when the year is leap.

    Any help is appreciated.

    Thank you all,

    Lopez

    PS: by the way, with this new version of Apple Comunity I seem to have lost my previous questions about the numbers.

    Hey Lopez,

    EOMONTH(A1,0) (end of month) will GET help you.

    Column B is Date & time format to display only the month and year (actually the 1st of the month, but the day is not displayed).

    Formula in C2 (fill down)

    = EOMONTH(B2,0)

    The end of the month 0 months later.

    Formula in D2 (fill down)

    = DAY (C2)

    February 2015 (non-leap years) shows 28

    February 2016 (leap year) shows 29

    Kind regards

    Ian.

  • Why my display of the date of the mailbox does not have a / between the year and the month?

    I'm talking here about how the date of different e-mails appear in my Inbox. I have a / between the month and the day, and a / after the day, but I did not / between the year and the month.

    TB uses the date format short, such that defined by your operating system, which, in the case of Windows, is located in the Panel control/region and language.

    http://KB.mozillazine.org/Date_display_format

    There are a few modules that might also be useful:

    https://addons.Mozilla.org/en-us/Thunderbird/addon/ConfigDate/

    https://addons.Mozilla.org/en-us/Thunderbird/addon/Super-date-format/

    http://chrisramsden.vfast.co.UK/3_How_to_install_Add-ons_in_Thunderbird.html

  • Why see Moments does not show the year?

    The date, that the photos were taken is the title at the top of every moment.  Until the end of last year, he gave the month, day and year.  Now, he gives only the month and day.

    Is it for the current year only? and when we arrive at the beginning of a new year the year 2016 will build upon these Moments?

    Yyes, it is only for the current year and will change next year.

Maybe you are looking for

  • Restrict user access to admission 0-9 for the string data

    Hello I want to this control at the entrance façade. This control allows the user to choose between 0-9. For example 0 1 2 3 4 5 6 7 8 9. Control do not allow the user to upgrade-1-2-3... 10 11 or... or decimal. This number will be still converted to

  • Windows 7 / HP OfficeJet Pro 8600: Installation network without success

    OS: Windows 7 Professional 64-bit Printer: HP OfficeJet Pro 8600 My goal is to enable the "Scan to Computer" feature of my HP OfficeJet Pro 8600 on Windows 7, which does not find my computer when I try to use since the touchscreen front panel of the

  • How to recover my data from my hard drive?

    I think I already know the answer to this, but here goes: I have a 80 GB IBM sister hard drive who died (not even turn to the top). Nothing exists to get the data on the drive (which only cost me a million dollars?

  • Book 15 G2 Z: removing keyboard access SODIMM slots

    How can I remove the keyboard of a book 15 G2 Z to access the other 2 RAM SODIMM slots. I want to get up to Maximum 32 GB of RAM and can easily access 1 and 2 housing by removing the back cover. But I can't understand how go down the keyboard to acce

  • 3005 integrated VPN with ACS and server RSA auth

    Hi guys, I have a VPN 3005, using the version 4.7.2.B version, and I have the following problem. When a remote user using the Cisco VPN client tries to connect to the VPN 3005, it must try twice to authenticate. The first test, the user is authentica