Want to remove iteration in this query

below mention query is showing results ok but problem is i have used iteration due to this it will slow down many many times if no. of transactions increases
can i use this query without iteration please help me out?
select
SNO,NDATE,SERIALNO,LOCATIONCODE,IORTYPE,TRNTYPE,CAPITALIZE,QTYRATE,ACCESSORYCODE,QTY,RATE,AMOUNT "AMT",C_QTY "RUNQTY",AVG_RATE "RUNRATE",C_AMOUNT "RUNAMT"
from ( select * from ( select t.*, max(dim) over () number_of_iterations,
max(dim) over (partition by accessorycode) number_of_item_codes
from ( select t.*, row_number() over (partition by ACCESSORYCODE order by SNO) - 1 dim
from DENIM.V_RUNAVG1 t) t)
model partition by (accessorycode)
dimension by (dim)
measures (SNO,NDATE,SERIALNO,LOCATIONCODE,IORTYPE,TRNTYPE,CAPITALIZE,QTYRATE,QTY,RATE,AMOUNT,0 as C_QTY,0 as AVG_RATE,0 as C_AMOUNT, number_of_iterations,number_of_item_codes) rules iterate (10) until iteration_number >= number_of_iterations[1] ( rate[iteration_number] = case when iteration_number > 0 and qtyrate[iteration_number] < 0 then avg_rate[iteration_number - 1] else rate[iteration_number] end, amount[iteration_number] = qty[iteration_number] * rate[iteration_number], c_amount[iteration_number] = case when iteration_number > 0 then c_amount[iteration_number - 1] + amount[iteration_number] else amount[iteration_number] end, c_qty[iteration_number] = qty[iteration_number] + case when iteration_number > 0 then c_qty[iteration_number - 1] else 0.0000000001 end, avg_rate[iteration_number] = c_amount[iteration_number] / c_qty[iteration_number] )) where dim <= number_of_item_codes order by accessorycode, dim

TKPROF: Release 10.1.0.2.0 - Production on Thu Jun 5 03:35:34 2008
Copyright (c) 1982, 2004, Oracle.  All rights reserved.
Trace file: d:\oracle\product\10.1.0\admin\sd\udump\sd_ora_2420.trc
Sort options: default
count    = number of times OCI procedure was executed
cpu      = cpu time in seconds executing
elapsed  = elapsed time in seconds executing
disk     = number of physical reads of buffers from disk
query    = number of buffers gotten for consistent read
current  = number of buffers gotten in current mode (usually for update)
rows     = number of rows processed by the fetch or execute call
alter session set sql_trace true
call     count       cpu    elapsed       disk      query    current        rows
Parse        0      0.00       0.00          0          0          0           0
Execute      1      0.00       0.04          0          0          0           0
Fetch        0      0.00       0.00          0          0          0           0
total        1      0.00       0.04          0          0          0           0
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 91 
select
SNO,NDATE,SERIALNO,LOCATIONCODE,IORTYPE,TRNTYPE,QTYRATE,ACCESSORYCODE,INVTYPE,
QTY,RATE,AMOUNT
"AMT",C_QTY "RUNQTY",AVG_RATE "RUNRATE",C_AMOUNT "RUNAMT"
from ( select * from ( select t.*, max(dim) over () number_of_iterations,
max(dim) over (partition by accessorycode) number_of_item_codes
from ( select t.*, row_number() over (partition by ACCESSORYCODE order by
SNO) - 1 dim
from DENIM.WGTAVGRATE1 t) t)
model partition by (accessorycode)
dimension by (dim)
measures
(SNO,NDATE,SERIALNO,LOCATIONCODE,IORTYPE,TRNTYPE,INVTYPE,QTYRATE,QTY,RATE,AMOUNT,0
as C_QTY,0 as AVG_RATE,0 as C_AMOUNT,
number_of_iterations,number_of_item_codes) rules iterate (700) until
iteration_number >= number_of_iterations[1] ( rate[iteration_number] = case
when iteration_number > 0 and qtyrate[iteration_number] < 0 then
avg_rate[iteration_number - 1] else rate[iteration_number]      end,
amount[iteration_number]   = qty[iteration_number] * rate[iteration_number],
c_amount[iteration_number] = case when iteration_number > 0 then
c_amount[iteration_number - 1] + amount[iteration_number] else
amount[iteration_number] end, c_qty[iteration_number] =
qty[iteration_number] + case when iteration_number > 0 then
c_qty[iteration_number - 1] else 0.0000000001   end,
avg_rate[iteration_number] = c_amount[iteration_number] /
c_qty[iteration_number]   )) where dim <= number_of_item_codes order by
accessorycode, dim
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.00       0.02          0          0          0           0
Execute      1      0.00       0.01          0          0          0           0
Fetch     2169    127.60     166.60       1244        382          0       32516
total     2171    127.60     166.65       1244        382          0       32516
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 91 
Rows     Row Source Operation
  32516  SORT ORDER BY (cr=382 pr=1244 pw=868 time=166423096 us)
  32516   VIEW  (cr=382 pr=1244 pw=868 time=23883740 us)
2516500    SQL MODEL ORDERED FAST (cr=382 pr=1244 pw=868 time=36303648 us)
  32516     VIEW  (cr=382 pr=376 pw=0 time=3313485 us)
  32516      WINDOW BUFFER (cr=382 pr=376 pw=0 time=3183412 us)
  32516       VIEW  (cr=382 pr=376 pw=0 time=3096441 us)
  32516        WINDOW SORT (cr=382 pr=376 pw=0 time=2933851 us)
  32516         VIEW  (cr=382 pr=376 pw=0 time=2877298 us)
  32516          SORT ORDER BY (cr=382 pr=376 pw=0 time=2747228 us)
  32516           HASH JOIN  (cr=382 pr=376 pw=0 time=1891717 us)
  14134            TABLE ACCESS FULL OBJ#(57651) (cr=206 pr=203 pw=0 time=111724 us)
  32516            TABLE ACCESS FULL OBJ#(57650) (cr=176 pr=173 pw=0 time=195574 us)
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.00       0.02          0          0          0           0
Execute      2      0.00       0.05          0          0          0           0
Fetch     2169    127.60     166.60       1244        382          0       32516
total     2172    127.60     166.69       1244        382          0       32516
Misses in library cache during parse: 1
Misses in library cache during execute: 1
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call     count       cpu    elapsed       disk      query    current        rows
Parse        2      0.00       0.00          0          0          0           0
Execute      2      0.00       0.01          0          0          0           0
Fetch        2      0.00       0.00          0          4          0           1
total        6      0.00       0.01          0          4          0           1
Misses in library cache during parse: 2
Misses in library cache during execute: 2
    2  user  SQL statements in session.
    2  internal SQL statements in session.
    4  SQL statements in session.
Trace file: d:\oracle\product\10.1.0\admin\sd\udump\sd_ora_2420.trc
Trace file compatibility: 10.01.00
Sort options: default
       2  sessions in tracefile.
       2  user  SQL statements in trace file.
       2  internal SQL statements in trace file.
       4  SQL statements in trace file.
       4  unique SQL statements in trace file.
    4740  lines in trace file.
     298  elapsed seconds in trace file.

Similar Messages

  • Will be International for 5 months and want to remove plan for this time

    I will be studying in Austria for an extended period of time and would like to bring my iphone5, but not use any sort of plan with it (I'll just use wifi and as a camera). Right now I have a contract for several years (unlimited talk, text, and 2GB data) and pay $60 a month for it. There are two other phones on my account. I was wondering if I could just remove my phone for these months (and not pay for a service I wouldn't even be using) and then resume my plan when I return in July.

    You can't "remove" your phone for this time without paying the ETF since you are under contract.
    Verizon allows you to "suspend" service without billing for 90 days at a time. Once the 90 days is up, your service will automatically restart. Once it restarts, you can go back in and suspend it again. Verizon allows you to do this twice in a year for a total of up to 180 days in a year. Unfortunately, with the service automatically restarting again after 90 days, you will most likely have 1 month of service for which to pay.
    While in Austria, you should be able to simply remove your Verizon SIM card and insert a SIM card from a local provider to get service thru them.

  • I want to remove whats on this laptop's iTunes, how?

    My hubs let me have his old MacBook Pro so I want to get rid of his stuff on iTunes and put my awesome heavy metal noise on it, where do I start?
    I had everything on my MacMini but the HDD had a heart attack and died lol...i just wanna get my stuff here.

    Log in to the Mac App Store using your credentials on her laptop then go to the Purchsed tab.

  • How to remove the DATA Provider(Query) from the WAD 3.5

    Hi,
         I want to remove the unused dataprovider(query) from the WAD 3.5,
         How to delete the dataprovider.
    Please suggest here

    Go to HTML tab. You will see all the data providers on top. You can delete the unused ones there.

  • Want to remove Characterstics Structure on run time ( Query Designer )

    Dear Friends,
    I have a query where i defined one Characterstics Structure. Its working fine.
    When i run the report this structure is comming by default.
    If i want to remove means drag and drop this structure like other characterstics and key figures its not working.
    How can i achieve this scanrio.
    Regards
    Naeem

    Hi,
    i want to put structre in free charachterstics on run time.
    It is not possible. You can include only navigational attributes in Free Char section of the Query.
    You can have Structures only in Rows and Columns. You can have only two structures per Query.
    Regards,
    Suman

  • The query screens are case sensitive I want to remove the case sensitivity

    The current query screens are case sensitive ,I want to remove the case sensitivity is there a setting somewhere to remove this or how else can this be done.
    Example:In the restrict value range of the query screen.If we give for a particular field anything in capital letters/small it should take.
    Please let me know ASAP
    Thanks

    Hi pavan,
    generally case sensivity is related to InfoObject Master Data.
    Take a look via Tcode RSD1 to the master data of your InfoObject and check in first screen if flag for capitol letters has been marked.
    If this is the situation it is a problem, because MAster Data in cube have been saved as different if are written like "Letter" or "LETTER".
    Ciao.
    Riccardo.
    Message was edited by:
            Riccardo Venturini

  • I want to remove all of my photos out of iPhoto there are approximately 35000 some imported from an old hard drive and a SD Card from my Nikon D500 how do I do this

    I want to remove all of my photos out of iPhoto there are approximately 35000 some imported from an old hard drive and a SD Card from my Nikon D500 how do I do this?
    I have iPhoto version 9.1.5 (615)
    Mac OS X version 10.6.8
    I want to do this because when I imported from my old hard drive there was an error message stating that 12 photos were not imported as the programm did not recognise the format even though they were jpegs like the other photos in that particular album. The dates of the photo folders are wrong I have multiple copies of photos and every time I start iPhoto I get the following message 12 photos have been found in the iPhoto library that were not imported would you like to import them No or Yes
    if you press Yes the same message comes back again and if you press Yes again the program flicks to last import for 2 seconds and then opens events.
    if you press No the message The photos have been placed in the folder/user/judith/pictures/iphoto Library recovered photos then if you press OK the original message 12 photos have been found.............
    if you press No at this point the message The photos have been placed in the folder/user /judith/pictures/iphoto Library recovered photos_11 the end number goes up by 1 every time you go through this process
    Any help would be greatly appreciated

    Did you import an iPhoto Library from the old Hard Drive? Do you still have that old Library?
    The way to clear out a Library is to Export the photos - Apps like iPhoto2Disk or PhotoShare will help you export to a Folder tree matching your Events.
    For the annoying start-up message:
    Go to your Pictures Folder and find the iPhoto Library there. Right (or Control-) Click on the icon and select 'Show Package Contents'. A finder window will open with the Library exposed.
    Look there for a Folder called 'Import' or 'Importing'.
    Drag it to the Desktop. *Make no other changes*.
    Start iPhoto. Does that help?
    If it does then look inside that folder on your desktop. Does it contain anything you want? If not you can trash the folder.

  • I am wanting to remove my credit card from my iTunes account. How do I do this??

    I am wanting to remove my credit card details from my iTunes account. How do I do this???

    On your computer's iTunes you should be able to edit your payment info by going into the Store > View Account menu option and logging into your account, and on your account's details page there should be a payment link.  If you are doing it on your iOS device then try tapping on your id in Settings > iTunes & App Store and selecting 'View Apple ID' on the popup - that should also give you a payments link on your account's page.
    Changing payment info : http://support.apple.com/kb/HT1918
    If you don't get the 'none' option on the payment details screen then do you owe iTunes anything or have any pre-orders/subscriptions due : http://support.apple.com/kb/TS5366 ?

  • My Macbook pro was stolen 09/12, the police just returned it to me. I want to remove all the data and start over. Format the drive's etc. I have windows 7 on 1 partion and mountain lion OSX on the apple partition. How is the best way to do this?

    My Macbook pro was stolen 09/12, the police just returned it to me. I want to remove all the data and start over. Format the drive's etc. I have windows 7 on 1 partion and mountain lion OSX on the apple partition. How is the best way to do this?

    Have a look here...
    what-to-do-when-your-hard-drive-is-full.html

  • How to remove stocks, weather,clock, notes, reminders, youtube, game center calc, voice memos,calendar, maps, and stocks? As a person who blew 300 bucks I think I should have a choice if I want to remove this crap but can't figure out how.

    How to remove stocks, weather,clock, notes, reminders, youtube, game center calc, voice memos,calendar, maps, and stocks? As a person who blew 300 bucks I think I should have a choice if I want to remove this crap but can't figure out how.
    any help would make me happy. As it stands now from looking on the web it can't be deleted but making sure before i return this ipod touch. I wan't a clean item the way I wan't it and not how they want it. Like I do not need Itunes and App Store on this ipod because I use my computer only to shop, So many things i like out of the ipod and I am sure lots more people also would like a cleaner ipod/phone or what ever.
    from looking at what I never use I see a total of 14 app's I not want taking up space and my screen.
    yup with the 5.0 came another stupid icon i not like. ( Newsstand )

    yes i moved them into a folder, but I not want them at all on my screen. Guess I return this and pick up a
    Zune HD
    less app's on that then ipod touch. thank you for the responce.

  • I have some content in my library that I do not want to sync with my ipod touch. The content has previously been synced and I want to remove it without deleting it from my itunes library. Is this possible?

    I have some music content in my itunes library that I do not want to sync with my ipod touch. The content has previously been synced and I want to remove it without deleting it from my itunes library. Is this possible?

    Hi Pez,
    iTunes in the Cloud is not iCloud. Any songs that you have purchased but have not downloaded (or have deleted), go to iTunes in the cloud. The setting I mentioned will show all of your purchases in the various views in the Music app, whether they are on your device or not. If you turn that setting off, you will only see items that are actually on your device.
    Glad to hear the second sync worked! But if they all start appearing again, make sure that setting is turned off
    Cheers,
    GB

  • How to remove the OR clause in this query?

    Hello Everyone,
    I have this query where i have a lot of joins and in the where clause there is a ISNULL and conditions based on OR clause.
    How to remove the use of the OR clause which may cause performance problems? Can anyone suggest a method to remove the OR clause?
    select RS.PLANNEDSTART,
    OD.ESTSHIPDATE
    FROM TABLE1 RS(NOLOCK)
         INNER JOIN TABLE2 SS(NOLOCK)
         ON RS.ID1             = SS.ID1
         INNER JOIN TABLE3 AM(NOLOCK)
         ON AM.KEYID        = SS.KEYID
         INNER JOIN TABLE4 OD(NOLOCK)
         ON SS.KEYID= OD.KEYID
        INNER JOIN TABLE 8 DR
       ON
    WHERE              (isnull(RS.DATE1,'1970-01-01 00:00:00.000') ='1970-01-01 00:00:00.000'
                     AND OD.DATE1 between @Beginning_Route_Date and @Ending_Route_Date)
                 OR
                 RS.DATE1!='1970-01-01 00:00:00.000'
                   AND RS.DATE1 BETWEEN  @Beginning_Route_Date and @Ending_Route_Date)              
    Regards
    Gautam S
    Gautam S

    this is one way avoiding OR clause
    WHERE CASE WHEN isnull(RS.DATE1,'1970-01-01 00:00:00.000') ='1970-01-01 00:00:00.000'
    THEN OD.DATE1 ELSE RS.DATE1 END between @Beginning_Route_Date and @Ending_Route_Date)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • I want to remove the header and footer when printing from my mac, i can do this in the Page Setup on my PC but not on the Mac. I can do it each time I print but then it resets. How do I make a universal change?

    I want to remove the header and footer when printing from my mac, I can do this in the Page Setup on my PC but not on the Mac. I can do it each time I print but then it resets. How do I make a universal change?
    == This happened ==
    Every time Firefox opened

    Go to the "File" menu, then "Print." The window that appears will have three drop-down menus at the top.
    The first is labeled "Printer",
    The second is "Presets".
    The third is unlabeled but has "Copies & Pages" selected by default.
    Click on that third menu and select "Firefox" near the bottom of the list.

  • What can i do for removing SINGLE in this select query??

    What can i do for removing SINGLE in this select query given below and also NOT USE 'ENDSELECT'??
    I have defined g_t_zv7_cachemapping as following ::
    DATA : BEGIN OF g_t_zv7_cachemapping OCCURS 0,
             kostl LIKE zv7_cachemapping-kostl,
             END OF g_t_zv7_cachemapping.
    SELECT SINGLE kostl FROM zv7_cachemapping INTO g_t_zv7_cachemapping
               WHERE  auart = g_t_vbak-auart.
            IF sy-subrc = 0 .
            ENDIF.

    Shashank,
    DATA : BEGIN OF g_t_zv7_cachemapping OCCURS 0,
    AUART LIKE zv7_cachemapping-AUART,
    kostl LIKE zv7_cachemapping-kostl,
    END OF g_t_zv7_cachemapping.
    If not g_t_vbak[] is initial.
    SELECT auart kostl
      FROM zv7_cachemapping INTO table g_t_zv7
    for all entries in g_t_vbak
    WHERE auart = g_t_vbak-auart.
    Endif.
    sort : g_t_zv7 by auart , 
              g_t_vbak by auart.
    loop at g_t_vbak.
      READ TABLE g_t_zv7 WITH KEY AUART = g_t_vbak-AUART
                                        BINARY SEARCH.
       IF sy-subrc eq 0.
       ENDIF.
    endloop.
    Pls. reward if useful

  • I want to cut out a head from a photo and insert it into another photo again. In the head hair flying in the wind and the blue sky can be seen between the hairs. This blue sky I want to remove, so I can only use the head with hair flying in another photo.

    I want to cut out a head from a photo and insert it into another photo again. In the head hair flying in the wind and the blue sky can be seen between the hairs. This blue sky I want to remove, so I can only use the head with hair flying in another photo. Is it possible to simply delete this blue color of the sky?

    Make your selection and then use Refine Edge.
    See this video tutorial from Bob Gager.
    https://www.youtube.com/watch?v=xrl3Qwg6zSc

Maybe you are looking for

  • How do I transfer the music from my iPhone to my MacBook?

    I recently purchased a 2007 MacBook online. Everything works fine, I don't think it's the computer that's the problem. The iTunes that I downloaded on it was to old so I had to update it to the latest version. At the time I was also updating my Mac s

  • Audio drivers for Compaq C770LA for Win XP Pro / integrated mic not working

    Hello. I have downgraded a Compaq C770LA to Win XP Pro SP3. Almost everything seem works perfect, but I have tried several audio drivers and still can´t get to control or use the integrated mic which this notebook has. I can hear audio and even recor

  • What has happened to iWeb and mobile me?

    Hi am looking to create a website.  thought I'd use iWeb but cannot find detail on Mobile me.  Has it all been superseeded? Thanks

  • Can anyone help every time i try to load final draft this happens

    EVERY TIME I TRY AND LOAD THIS IT CRASHED, SO I LOADED IT FROM AN EXTERNAL HARD DRIVE, NO PROBS, JUST UPGRADED SOFTWARE TO MOUNTAIN LION 10.8.3 AND ITS DOING IT AGAIN, THERES SOME AMAZING POSTS ABOUT THE EXC BAD ACCRESS AND KERN INVALID ADDRESS, BUT

  • Drop down menus in firefox

    Hi, can anyone tell me why these drop down menus are working in firefox 1 but not in firefox 2.0.0.6. They were working ok in all browsers and I have now made the site template based and the issue is since then...not exactly sure at what stage it sto