Show difference between the years and how much money increased ever year

Hi everyone
I need to make the following code show how many years it took for it to reach its required goal.
show difference between the years and how much money increased ever year. ..
I am totally confused at the moment... any help would be greatly appreciated...
declare
a number(9):=1000;
b number(9);
c number(9);
d number(9);
begin
for d in 2012..2099
loop
dbms_output.put_line(a||' '||d);
if a >2000 then
exit;
end if;
a :=a + a*10/100;
end loop;
end;
Result for above query:
Price Years
1000 2012
1100 2013
1200 2014 etc...
I need to show the amount of years it took to reach its goal, which was $2000
and also the change in price, how much it increased every year...
Thanks
Umair

960361 wrote:
Hi everyone
I need to make the following code show how many years it took for it to reach its required goal.
show difference between the years and how much money increased ever year. ..
I am totally confused at the moment... any help would be greatly appreciated...
declare
a number(9):=1000;
b number(9);
c number(9);
d number(9);
begin
for d in 2012..2099
loop
dbms_output.put_line(a||' '||d);
if a >2000 then
exit;
end if;
a :=a + a*10/100;
end loop;
end;
Result for above query:
Price Years
1000 2012
1100 2013
1200 2014 etc...
I need to show the amount of years it took to reach its goal, which was $2000
and also the change in price, how much it increased every year...
Thanks
UmairHow do I ask a question on the forums?
SQL and PL/SQL FAQ

Similar Messages

  • Increase in price, yearly.. and calculate the difference between the years.

    Hi everyone
    I need to make the following code show how many years it took for it to reach its required goal.
    show difference between the years and how much money increased ever year. ..
    I am totally confused at the moment... any help would be greatly appreciated...
    declare
    a number(9):=1000;
    b number(9);
    c number(9);
    d number(9);
    begin
    for d in 2012..2099
    loop
    dbms_output.put_line(a||' '||d);
    if a >2000 then
    exit;
    end if;
    a :=a + a*10/100;
    end loop;
    end;
    Result for above query:
    Price Years
    1000 2012
    1100 2013
    1200 2014 etc...
    I need to show the amount of years it took to reach its goal, which was $2000
    and also the change in price, how much it increased every year...
    Thanks
    Umair

    Hi Umair ,
    I am not sure why you have created so many different variables. ( b , c , d )
    Try this
    declare
        a                number(9)  :=1000;
        cnt              number      := 0;
    begin
        for d in 2012..2099 loop
            if a > 2000 then    
                exit;
            end if;
            dbms_output.put_line(a||'   '||d);
            a :=a + a*10/100;
            cnt := cnt + 1;
        end loop;
        dbms_output.put_line( 'Number of years required to reach the goal are:- ' || to_number(cnt) );
    end;
    /If you want to show number of years in yyyy way ( example :- 2020) then set cnt to 2012 as for loop is starting with 2012.
    Thanks.

  • What are the functional differences between the iPhone and the iPod Touch, barring of course the differences in service requirements.

    What are the functional differences between the iPhone and the iPod Touch, barring of course the differences in service requirements.

    For one, their form factors are slightly different as the iPhone has a bit more squarish body whereas the iPod Touch has a tapered back to it. 
    The iPhone also has much better front and rear cameras. Exact details as to the difference in megapixels depends on whether or not you talking about the iPhone 4 or 4S.  If you would like to get more details, you can always view
    each models specs on Apple's online store.
    See here for a better explanation.
    http://en.wikipedia.org/wiki/IPod_Touch#Comparison_to_the_iPhone
    I'm sure others will chime in with other things as well.
    B-rock

  • Difference between the user_bytes and the bytes of dba_data_files

    What's the difference between the user_bytes and the bytes column of the dba_data_file view?

    Hi,
    >>Bytes : Size Occupied
    No. The size of the datafile. Doesn't matter free or used space.
    >>User Bytes: Size available for Occupying.
    No and Yes. Keep in mind that it shows the total size of the file available for user data since it was creation minus the related metadata information.
    In resume, take a look at below:
    You can see below, that datafile has 1,500 MB of size but it has 1,499.9375 MB available for user data.
    LEGATTI@ORACLE10> select file_id,file_name,bytes,user_bytes from dba_data_files where tablespace_name='USERS2';
       FILE_ID FILE_NAME                                         BYTES USER_BYTES
             7 /u02/oradata/DB01/user02.dbf                 1572864000 1572798464
    LEGATTI@ORACLE10> SELECT Substr(df.tablespace_name,1,20) "Tablespace Name",
      2         Substr(df.file_name,1,40) "File Name",
      3         Round(df.bytes/1024/1024,2) "Size (M)",
      4         df.increment_by "Increment By",
      5         Round(e.used_bytes/1024/1024,2) "Used (M)",
      6         Round(f.free_bytes/1024/1024,2) "Free (M)"
      7  FROM   DBA_DATA_FILES DF,
      8         (SELECT file_id,
      9                 Sum(Decode(bytes,NULL,0,bytes)) used_bytes
    10          FROM dba_extents
    11          GROUP by file_id) E,
    12         (SELECT Max(bytes) free_bytes,
    13                 file_id
    14          FROM dba_free_space
    15          GROUP BY file_id) f
    16  WHERE  e.file_id (+) = df.file_id
    17  AND    df.file_id  = f.file_id (+)
    18  AND    df.file_id = 7
    19  ORDER BY df.tablespace_name,
    20           df.file_name;
    Now, you can see that just 874 MB has been used from 1,499.9375 MB real space available.
    Tablespace Name      File Name                                  Size (M) Increment By   Used (M)   Free (M)
    USERS2               /u02/oradata/DB01/user02.dbf                  1,500            0     874.88     625,05Now, is that clear?
    Cheers
    Legatti

  • Difference between the archive and cache_archive in object tag

    hello,
    I am trying to find the difference between the archive and cache_archive for the object tag to use for applet.
    I was going through this link which discusses the applet caching :
    http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/applet_caching.html
    Especially : A sticky applet is placed in a disk cache created and
    controlled by Java Plug-in which the browser cannot overwrite.How do i find what is the disk cache on my machine, and how different it is from the normal cache.
    Currently i am using the normal archive parameter in object tag, and when i go to the java plugin control panel, i see all the downloaded jars.
    But wanted to know how will it be different from using the cache_archive parameter.
    Please advise,
    Edited by: duskandawn on Jun 10, 2009 11:07 AM

    Hi Juraj!
    I feel the same too - Except the fact that SessionFacade is used to access EJBs while the VO are built as response objects (i.e. assembled) and unassembled by different web requests.
    rnats

  • What's the difference between the LRU and NRU strategy for stateful session bean?

    Hi,
    Does anybody know the difference between the LRU and NRU strategy for
    stateful session bean?
    Thanks,
    Levi

    LRU makes the assumption that the bean that has been used a lot recently is
    likely to be used again.
    NRU simply removes the beans that have not been used for a stipulated amount
    of time.
    The algorithm for the LRU is much more complicated than the NRU. I think BEA
    recommends LRU for better performance and NRU when you have memory
    constraints.
    "levi" <[email protected]> wrote in message
    news:[email protected]..
    Hi,
    Does anybody know the difference between the LRU and NRU strategy for
    stateful session bean?
    Thanks,
    Levi

  • Is there any difference between the iPod and the iPod hp?

    I'm new to iPods so forgive me if this is a foolish question but I've been thinking for a few weeks now about getting my daughter the shuffle. I bought the 1gb iPod shuffle hp today in Staples because they had it on sale but I'm wondering if there's any drawbacks to buying this one compared to buying it directly from Apple? As far as the electronics, is there any difference between the iPod and the hp iPod?

    Welcome to Apple Discussions!
    Electronically, there is no difference. The only difference comes in support. Apple allows you to call them for 90 days and one issue after you buy them, supporting windows and macs. HP will only help you if you are using a windows, however that support lasts one year. Keep in mind that if you need support, you'll have to go to an HP authorized repair center or another one of HP's options as the apple repair site and apple stores can't help in that regard.
    btabz

  • HT202157 What is the difference between the 1st and 2nd generation Apple TV?

    What is the main difference between the 1st and 2nd generation Apple TV's? I just got the 1st generation and was wondering if I should send back for the 2nd gen?

    There is one other difference. The ATV3 uses a new processor with a better graphic processing unit.  If you only had the ATV2 for less than 14 day. Why not upgrade. 1080p video will be a little sharper, but in reality most people won't notice any real difference. It's likely that Apple will stop supporting the ATV 1st gen and 2nd gen in couple of years. Apple as a company usually only supports hardware 5-6yrs max! 

  • What is the difference between the i5 and i7 processors

    What is the difference between the i5 and i7 processors

    about 15% faster speed on high end applicatoins
    Here is an excellent video comparison between the 11” I5 vs. I7 2013 Macbook Air.
    http://www.youtube.com/watch?v=oDqJ-on03z4
    http://www.anandtech.com/show/7113/2013-macbook-air-core-i5-4250u-vs-core-i7-465 0u/2
    I5 vs. I7 performance 13” Macbook Air 2013
    Boot performance
    11.7 I5 ……11.4 I7
      Cinebench 
    1.1 I5….1.41 I7
    IMovie Import and Opt.
    6.69 I5….5.35 I7
      IMovie Export 
    10.33 I5…8.20 I7
    Final Cut Pro X
    21.47 I5…17.71 I7
      Adobe Lightroom 3 Export 
    25.8 I5….31.8 I7
    Adobe Photoshop CS5 Performance
    27.3 I5…22.6 I7

  • What are the major differences between the air and the pro

    what are the major differences between the air and the pro?

    In a nutshell, the Air is a lightened, more compact system than the 13" Pro counterpart. The Air loses some hardware features to accommodate the physical downsizing.
    No FireWire port
    No built-in optical drive
    A lesser performing CPU to retain battery charge life, and adequate cooling.
    No Ethernet port
    No Kensington lock slot
    The Air does have a superior native resolution at 1440 x 900, and a standard SSD that does make up alot of the speed differential, and then some. Of course, the 13" Pro can be optionally configured with an SSD.
    You buy the Air if the physical size an weight savings are demonstrably more important than the features lost.

  • Differences between the 2007 and 2009 160GB Ipod Classic?

    What are the differences between the 2007 and 2009 160GB Ipod Classic?

    The 2009 model is slimmer. Click here for more information.
    (50305)

  • DIFFERENCE BETWEEN THE FULL AND BULK-LOGGED RECOVERY MODEL

    DIFFERENCE  BETWEEN THE  FULL AND BULK-LOGGED  RECOVERY MODEL 

    In bulk logged recovery mode certain bulk operations are minimally logged. In FULL recovery mode these are fully logged. These bulk operations are as mentioned below
    1. SELECT INTO
    2. BULK IMport operations including BULK INSERT and BCP
    3. INSERT INTO SELECT command using the OPENROWSET(BULK) function
    4. Partial updates to columns having large value data type
    5. Using WRITE clause in UPDATE statements
    6. Index operations e.g CREATE INDEX, ALTER INDEX REBUILD , DROP INDEX
    In Bulk Logged Recovery Mode when you execute these operations SQL Server only logs the fact that these operation occured and information about space allocation. The actual change in the data is maintained in the BCM (Bulk
    Changed Map)
    Since the actual changes are not recorded in the log file, the log file size in the reletively less in size but this tradeoff comes with the price of increased backup time. This is so because during the log backup its not just the log being backup, but also
    the extents that are marked by the Bulk Changed Map as changed.
    SQLEnthusiast
    http://sqlsimplified.com/
    Please click the Mark as Answer button if a post solves your problem!

  • In Oracle Forms What is the difference between the Regions and Blocks ?

    Hi,
    In Oracle Forms What is the difference between the Regions and Blocks ?
    thanks
    siva

    Hi Siva
    in oracle forms Block are entities which represent your data (table, views etc), you can say like EOs and VOs.
    Well I dont know about regions in forms.

  • What are major differences between the T5 and the T5i

    What are the major differences between the T5 and the T5i?

    Hey everyone!
    I just wanted to step in (which is not normal) to say something that most people overlook is that the EOS Rebel T5i has a self-cleaning sensor where the EOS Rebel T5 does NOT; also, the T5i can use an IR Remote (like the RC-6), and the T5 can only use cable releases. These are minor things until you need them! 
    I hope those two little things help!
    Oh, and here is the compare info: CLICK ME

  • What are the biggest differences between the 5C and the 5S?

    What are the biggest differences between the 5C and the 5S?

    I think as soon as the developers discover CoreMotion, all of the apps will migrate to using that so fast it will cause your head to spin.
    I think this will cause the obsolesces of more mobile hardware then anything prior to it. The whining and moaning on these forum is going to be so great.
    Allan

Maybe you are looking for

  • WTK2.2 Installation Problem on Suse 9.2

    Hi, I can't seem to install WTK2.2 on Suse 9.2 pro. I am using the JDK packaged with SUSE 9.2. Below is the version info: java version "1.4.2_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) Java HotSpot(TM) Client VM (build

  • Reduce file size

    How do you reduce file size in Acrobat XI Standard?

  • Blank images, loss of albums and various other bits.

    Hello all I've read any comments on moving my library to an external hard drive and followed them through. Holding 'option' down as I start iPhoto up and choosing the new library I get the following message: 'iPhoto library needs to be upgraded to wo

  • Possible to connect two base stations together?

    What I want to do is connect my Mini, Wii, and X-Box 360 to an N network but it's too far from my DSL line coming in. What I would like to see is if it is possible to have one base station connected to my DSL and another on the other side of the hous

  • XMLSocket Class

    My Flex Application is using XMLSocketClass for communicating with Webserver. But connection cannot be established. I am not getting any error message. I am using the follwing code for establishing the connection: ====================================