Re: Performance improvment -loop update.
Date: Thu, 24 Aug 2006 10:18:38 -0700
> well Dude sorry if find it offensive...i didn't mean that.....
> but i got a solution for it..i am posting newly written proc
> here....it's taking only some seconds....
> thanks a lot ppl...it was ny first time i asked for the help here..and
> i got nice response.
> Cursor c1 is
> Select a.SupplierCommentCode,
> from Ems_Currentsoexpedite_Tmp a, ems_currentsoexpedite b
> where upper(trim(a.FPRunIdentifier)) = (Select
> decode(count(distinct fprunidentifier),1,'EOD','FIRST')
> and (a.SupplierCommentCode is not null or
> a.CustomerCommentCode is not null or a.PCCommentCode is not null)
> and a.demandorderid=b.demandorderid
> and a.partnumber=b.partnumber
> and a.expediteqty=b.expediteqty
> and a.detailstoexpedite=b.detailstoexpedite
> and nvl(a.daterequired, trunc(sysdate))=nvl(b.daterequired,
> and upper(b.fprunidentifier)='EOD';
> For c1_rec in c1 Loop
> Update ems_currentsoexpedite
> Set SupplierCommentCode = c1_rec.SupplierCommentCode,
> CustomerCommentCode = c1_rec.CustomerCommentCode,
> PCCommentCode = c1_rec.PCCommentCode
> where rowid=c1_rec.rowid;
> /* where upper(trim(FPRunIdentifier)) =
> and trim(ShopOrderNumber) =
> and trim(nvl(RequestDate,trunc(sysdate))) =
> and trim(DemandOrderId) =
> and trim(PartNumber) =
> and nvl(promisedate,trunc(sysdate)) =
> and nvl(trunc(daterequired),trunc(sysdate)) =
> when others then
> End loop;
> v_stepid := v_stepid +10;
> -- Once the processing is done then delete the records from the temp
> execute immediate 'Truncate table EMS_CURRENTSOEXPEDITE_TMP';
> v_stepid := v_stepid +10;
> End update_emsaftnooncomments;
> DA Morgan wrote:
>> yogi wrote: >>> Hi all, >>> >>> Please help me in tuning this query... >> You've got to be kidding. I help a lot of people and try to keep >> an open mind but your question, as I read it, is offensive. >> >> You provide no information about the system >> No SLA >> No Explain Plan >> You have a cursor loop which has been repeatedly sited as inefficient >> compared with array processing. >> >> And then you want someone else to do what you are paid for? >> And urgently too? >> >> No! Perhaps I just need some coffee. But if you are not qualified >> to do your job then quit. >> >> Now I'll go get some coffee. ;-) >> -- >> Daniel A. Morgan >> University of Washington >> damorgan_at_x.washington.edu >> (replace x with u to respond) >> Puget Sound Oracle Users Group >> www.psoug.org
- Please do not top post. People read from top to bottom. Post your comments at the bottom.
[Quoted] And still no version number? Do you really want help or just to waste people's time?
[Quoted] 2. The single most important thing you can do to improve the performance of your code is to get rid of the cursor loop. I'm not sure why this couldn't be done with a simple update statement but if not you need to learn how to use BULK COLLECT and FORALL.
[Quoted] Demos in Morgan's Library at www.psoug.org.
[Quoted] And if you want help again be courteous to those who are trying to help you. You still didn't post a version number. In the future you need to make an effort.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Thu Aug 24 2006 - 19:18:38 CEST