Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

update statement is running for hours

user13115886Mar 6 2016 — edited Mar 7 2016

Hi All,

The below two update statements are goin in to infinite time and keep on running for hours.

Can these be modified to MERGE or what is wrong in the below statement. Few times, it ran fine but few times, its stuck in this statement for hours.

please advise.

      UPDATE   po_headers_all

         SET   j.channel_account_manager =

                  (SELECT   ptnr.handle

                     FROM   po_partner ptnr

                    WHERE   LTRIM (ptnr.bp_link_id, '0') =

                               TO_CHAR (j.reseller_link_id));

UPDATE   po_headers_all j

         SET

               (j.sales_org_cd,

               j.disti_channel_cd

               ) =

                  (SELECT   DISTINCT sales_org, distribution_channel

                     FROM   po_sales c

                    WHERE   TRIM (C.MATERIAL) = TRIM (j.material_cd)

                            AND c.sales_org IN

                                     ('MCA1', 'MGB1', 'MIE1', 'MSG1', 'MUS1')

                            AND c.GACT_ASGN IS NOT NULL

                            AND ROWNUM = 1)  -- This statement returns multiple rows and am taking first row . will this cause any issue here

       WHERE   EXISTS

                  (SELECT   1

                     FROM   po_doc_lkp ptr

                    WHERE   ptr.profitcenter = j.profit_center_cd

                            AND ptr.flag = 'YES');

THankS

BK

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 4 2016
Added on Mar 6 2016
8 comments
718 views