Subquery in update not seeing parent value

Hi all,
I'm working on a complex update statement that I will try to state as simply as possible.
update table1 x set value1=(select value1 from table1
                                        where acct_num=x.acct_num
                                        and trans_dt=(select max(trans_dt) from table1 where acct_num=x.acct_num and [many more conditions])
                                        [and many more conditions]All of this is working fine. Where I reach the problem is when I need to add a condition to verify a field is not the same as the previous field in the table (if one exists), so I try this code I found online (and it works fine when I try it with test data)...
AND vend_id <>  NVL((SELECT vend_id FROM (SELECT c.*, ROWNUM rnum FROM (SELECT * FROM table1
                                                              WHERE acct_num=x.acct_num
                                                  AND trans_dt<x.trans_dt
                                                        ORDER BY trans_dt DESC) c
                                                     WHERE ROWNUM<=2)
                                      WHERE rnum>=2)
                        ,'XXX')but when I try to run it in the update query, I get an error, "x.trans_dt" invalid identifier. This is just another condition to what was posted in the first code block and Oracle "sees" all the x.* values there fine.
Can anyone tell me what is wrong here and how I can pass these values into this condition?
Thanks!

<tt>x.trans_dt</tt> and <tt>x.trans_dt</tt> are just nested too deeply (can only be on next level)
AND vend_id <> NVL((SELECT vend_id
                      FROM (SELECT c.*, ROWNUM rnum
                              FROM (SELECT *
                                      FROM table1
                            WHERE acct_num = x.acct_num
                              AND trans_dt < x.trans_dt
                            ORDER BY trans_dt DESC
                                   ) c
                    WHERE ROWNUM <= 2
                     WHERE rnum >= 2
                   'XXX'
                  )use <tt>merge</tt> to do the update
Regards
Etbin

Similar Messages

  • Not seeing parameter values in SBO while running a crystal report w/Zebra

    I am using the crystal reports addon for SAP Business One.  I created a report which prints a label (1"x3") on a zebra thermal printer.  If I run the report within SAP Business One with a default printer other then the zebra printer I see the drop downs for the parameter values.  However when I select the values and print it , the label does not print correctly.  It appears as if crystal thinks the label is 3"x1".  If I try to run the report with the zebra printer as a default printer within SAP Business One, the drop downs for selecting the parameters are gone.
    If I run the report within crystal 2008 directly, I have no problems with printing the label properly as long as the Zebra Printer is not the default printer.  I have updated crystal 2008 with all available service packs and updates.  I have made registry entries on the server and workstations to allow more than enough values to be seen in the parameter dropdowns.
    Does anyone have any idea why the report will not work when being executed within SAP Business One?

    Susan,
    I'm not sure if the attached thread is relevant for you? I am also searching related to issues with Zebra, although mine are with PLD.
    Re: Crystal Reports viewer(runtime) barcode printing problem

  • Windows update - Not seeing all types of updates when checking

    My problem is at one time, our 2008 R2 servers were all in a separate OU as all other machines and we had a GP for all of our Windows 7 machines to get updates from our WSUS.  Well, someone applied that policy to the whole domain which made the server
    OU inherit the WSUS policy.  Before I was in the position to manage our servers, previous admins would disable the policy, perform a gpupdate /force on each server and then download and install updates.  
    I fixed this in group policy so that the servers can go out to the Windows update site and get updates but I am not sure they are getting everything they need.  For example, I have an Exchange 2010 server which needs some security patches based on a
    scan with MBSA.  One id UR 8 for Exchange 2010 SP2 and one for  SP2 for MS Office 2010 filter pack.  They are both security which I would think should show up when checking for updates. I also have some servers that are missing SQL 2008 security
    updates along with Visual C++ 2008 and Visual Studio 2008 security updates.  They aren't showing either.
    Is there a way to check on each server where it is going to check for updates?  I have looked in some places in the registry but I can't find anything.  Below is a couple of screen shots to show what it looks like on the Exchange server.
    David Hood

    Have you enabled "get extra updates from Microsoft" ? (this enables product other than Windows, to get updates)
    If you are seeing updates for Windows, but not updates for Exchange nor SQL - then it's likely that those updates are not being published to WU/MU.
    DUH!!!, I did a face palm when I saw that first line.  Didn't even cross my mind to look at the log.  I did find where it is going to the Microsoft site to search for updates. 
    Nevermind!!! Had a brain fart.  I just saw the link at the bottom of the Windows update page on the server where is says "Get updates for other Microsoft products.  Find out more".  I clicked the "Find our more" link and
    it took me to the Microsoft site to install Microsoft update.  I did that, it ran another check, and BOOM, all my updates are there.  I spent a while on this issue this morning and couldn't find anything.  I feel a little stupid now, haha. 
    Thanks for the ultra fast responce though.  It helped me alot. 
    David Hood

  • Adobe Design Premium CS5 updater not seeing recent DW CS5 update... why?

    Hi,
    I know that an update for CS5 DW was released yesterday but when I open the CS5 updater it saw the update available for Adobe Camera RAW but NOT the one for DW.  Why?

    I wonder why they played it that way?... puzzeling.

  • Apple update not seeing Bootcamp 3.1 (WIN 7, 64 BIT)

    ok i have this problem for a while now. I look in my "programs and features" the the control panel and it says im updated to 3.1 but when i run apple update it tells me i need to download and install 3.1. i have uninstalled and reinstalled the 3.0 from my snow leopard disk multiple times. i have a imac early 2009. also if anyone know what is going on with the sound problems with the system please help i miss my internal speakers on the windows side(sounds like the speakers are low and cheap)

    well i finaly got the new 3.2 update and everything updated for the first time i run apple update and nothing comes up thanks apple for fixing that issue.

  • Update Record Field if Value Not Equal

    Hello All,
    I am using Toad for Oracle 10. I have a MERGE INTO Process that updates tbl_requisition based on FK - fk_allotment_id that equals parent table tbl_allotment PK - pk_allotment_id. Both tables have create, update and deletes triggers. The process is executed when a Apply Changes/update button is clicked from tbl_allotment. So, all the record data from tbl_allotment updates tbl_requisition record if the fk and pk keys are equal. My problem is if a record is updated within tbl_requisition. Now the record from tbl_requisition is different from tbl_allotment. If any value is updated from tbl_allotment for the matching pk_allotment_id = fk_allotment_id record from tbl_requisition. tbl_allotment record data will override the updated value within tbl_requisition. I would like to only update the values that were updated/changed and are not equal from tbl_allotment to tbl_requisition. Can anyone assist me with this?
    Begin
    MERGE INTO tbl_requisition req
    USING tbl_allotment alt
    ON (req.fk_allotment_id = alt.pk_allotment_id)
    WHEN MATCHED THEN
    UPDATE SET
         req.FK_JOBCODE_ID = alt.FK_JOBCODE_ID,
         req.FK_JOBCODE_DESCR = alt.FK_JOBCODE_DESCR,
         req.FK_JOBCODE_PAYRANGE = alt.FK_JOBCODE_PAYRANGE,
         req.FK_PAY_RANGE_LOW_YEARLY = alt.FK_PAY_RANGE_LOW_YEARLY,
         req.FK_DEPARTMENT_ID = alt.FK_DEPARTMENT_ID,
         req.FK_DIVISION_ID = alt.FK_DIVISION_ID,
         req.FK_NUMBER_OF_POSITIONS = alt.NUMBER_OF_POSITIONS,
         req.FK_DEPARTMENT_NAME = alt.FK_DEPARTMENT_NAME,
         req.FK_DIVISION_NAME = alt.FK_DIVISION_NAME,
         req.REPORT_UNDER = alt.REPORT_UNDER;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        dbms_output.put_line('No data found');
    End; Thanks for reading this thread and I hope someone can provide some assistance. If the create tables or anything is needed that is not a problem to provide.

    Thanks for responding Frank and providing the EXCEPTION information also. Here are my create tables and insert statement. I changed the child table from tbl_requisition to tbl_allotment_temp, same process though.
    CREATE TABLE  "TBL_ALLOTMENT"
       (     "PK_ALLOTMENT_ID" NUMBER,
         "FK_DEPARTMENT_ID" VARCHAR2(5),
         "FK_DIVISION_ID" VARCHAR2(100),
         "FK_JOBCODE_ID" NUMBER,
         "FK_JOBCODE_DESCR" VARCHAR2(100),
         "FK_JOBCODE_PAYRANGE" NUMBER(*,0),
         "FK_PAY_RANGE_LOW_YEARLY" NUMBER(*,0),
         "NUMBER_OF_POSITIONS" NUMBER,
          CONSTRAINT "PK_ALLOTMENT_ID" PRIMARY KEY ("PK_ALLOTMENT_ID") ENABLE
    CREATE TABLE  "TBL_ALLOTMENT_TEMP"
       (     "PK_ALLOTMENT_TEMP_ID" NUMBER,
         "FK_DEPARTMENT_ID" VARCHAR2(5),
         "FK_DIVISION_ID" VARCHAR2(100),
         "FK_JOBCODE_ID" NUMBER,
         "FK_JOBCODE_DESCR" VARCHAR2(100),
         "FK_JOBCODE_PAYRANGE" NUMBER(*,0),
         "FK_PAY_RANGE_LOW_YEARLY" NUMBER(*,0),
         "NUMBER_OF_POSITIONS" NUMBER,
          CONSTRAINT "PK_ALLOTMENT_TEMP_ID" PRIMARY KEY ("PK_ALLOTMENT_TEMP_ID") ENABLE
    INSERT INTO tbl_allotment
    (FK_DEPARTMENT_ID, FK_DIVISION_ID, FK_JOBCODE_ID, FK_JOBCODE_DESCR,
    FK_JOBCODE_PAYRANGE, FK_PAY_RANGE_LOW_YEARLY, NUMBER_OF_POSITIONS)
    values
    (00002, 0000220000, 100408, 'Revenue Analyst',
      2210, 38389, 5);Once data is created for tbl_allotment, this insert statement inserts the data to tbl_allotment_temp.
    INSERT INTO tbl_allotment_temp(
         PK_ALLOTMENT_TEMP_ID,
         FK_JOBCODE_ID,
         FK_JOBCODE_DESCR,
         FK_JOBCODE_PAYRANGE,
         FK_PAY_RANGE_LOW_YEARLY,
         FK_DEPARTMENT_ID,
         FK_DIVISION_ID,
         NUMBER_OF_POSITIONS)
        VALUES (
         :P3_PK_ALLOTMENT_ID,
         :P3_FK_JOBCODE_ID,
         :P3_FK_JOBCODE_DESCR,
         :P3_FK_JOBCODE_PAYRANGE,
         :P3_FK_PAY_RANGE_LOW_YEARLY,
         :P3_FK_DEPARTMENT_ID,
         :P3_FK_DIVISION_ID,
         :P3_NUMBER_OF_POSITIONS);Once any update occurs to tbl_allotment, this process updates tbl_allotment_temp based on temp.pk_allotment_temp_id = alt.pk_allotment_id.
    Begin
    MERGE INTO tbl_allotment_temp temp
    USING tbl_allotment alt
    ON (temp.pk_allotment_temp_id = alt.pk_allotment_id)
    WHEN MATCHED THEN
    UPDATE SET
         temp.FK_DEPARTMENT_ID = NVL (alt.FK_DEPARTMENT_ID, temp.FK_DEPARTMENT_ID),
         temp.FK_DIVISION_ID = NVL (alt.FK_DIVISION_ID, temp.FK_DIVISION_ID),
         temp.FK_JOBCODE_ID = NVL (alt.FK_JOBCODE_ID,    temp.FK_JOBCODE_ID),
         temp.FK_JOBCODE_DESCR = NVL (alt.FK_JOBCODE_DESCR, temp.FK_JOBCODE_DESCR),
         temp.FK_JOBCODE_PAYRANGE = NVL (alt.FK_JOBCODE_PAYRANGE, temp.FK_JOBCODE_PAYRANGE),
         temp.FK_PAY_RANGE_LOW_YEARLY = NVL (alt.FK_PAY_RANGE_LOW_YEARLY, temp.FK_PAY_RANGE_LOW_YEARLY),
         temp.NUMBER_OF_POSITIONS = NVL (alt.NUMBER_OF_POSITIONS, temp.NUMBER_OF_POSITIONS);
    End;Once the data is created within tbl_allotment the data is also inserted within tbl_allotment_temp. If tbl_allotment_temp.NUMBER_OF_POSITIONS value is changed from 5 to 10 is fine. The problem is when a update occurs within tbl_allotment and the updated field is not NUMBER_OF_POSITIONS. The changed field values from tbl_allotment should only update the field data within tbl_allotment_temp.
    UPDATE tbl_allotment_temp
    SET
    NUMBER_OF_POSITIONS = 10
    UPDATE tbl_allotment
    SET
    FK_JOBCODE_DESCR = 'Revenue Test'Now within tbl_allotment_temp only field FK_JOBCODE_DESCR should be updated to Revenue Test but my MERGE INTO process will update all the field values. So the updated NUMBER_OF_POSITIONS value 10 will now be 5. I would only like to update any changed value from tbl_allotment to tbl_allotment_temp. If any record value from tbl_allotment_temp was changed that value should not be updated from the MERGE INTO Process within tbl_allotment unless those values have been updated within tbl_allotment. Let me know if this is not clear so I can clarity more Frank.
    Edited by: Charles A on Aug 29, 2011 8:41 AM

  • Read does not see last update

    I've got multiple thread reading and modifying the same objects. Sometimes a read by one thread does not see a change made and committed by another thread. Looking at the log shows the update was done and it set the field properly. But the next read query returns the object with the old field value. Out of 100 executions this only occurrs 1-3 times. Is this a case of reading the old value from the read cache? If so, what is the best way to insure the read gets the latest version? I've tried setting the existence checking to database first and it didn't make any difference.

    Rick,
    I am going to assume this is all being done in a single JVM with a single ServerSession and thus one shared cache. If this is incorrect please correct me.
    When the scheduler commits the changes made are written first to the database and then following the commit they are made to the cache. You said the JMS messages are committed in the same JTS TX. I would verify that the JMS messages and UnitOfWork are actually being committed together.
    If all of the JTS TX stuff is right then what you are saying is that in a small percentage of cases the runner task is receiving the JMS message and reading the cached version of the objects prior to the scheduler's UnitOfWork completing its merge. This seems very unlikely given the simplicity of the changes described (but weirder things have happened, and its halloween).
    What I would check next is to make sure the runner task is forcing a refresh of the (query.refreshIdentityMapResults) and if you are using optimistic locking then configure the descriptor to onlyRefreshIfNewerVersion. Let us know if this eliminates the condition and if all of my assumptions are correct.
    Doug

  • Sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loop

    sir i have given lot of effort but i am not able to solve my problem either with notifiers or with occurence fn,probably i do not know how to use these synchronisation tools.

    sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loopHi Sam,
    I want to pass along a couple of tips that will get you more and better response on this list.
    1) There is an un-written rule that says more "stars" is better than just one star. Giving a one star rating will probably eliminate that responder from individuals that are willing to anser your question.
    2) If someone gives you an answer that meets your needs, reply to that answer and say that it worked.
    3) If someone suggests that you look at an example, DO IT! LV comes with a wonderful set of examples that demonstate almost all of the core functionality of LV. Familiarity with all of the LV examples will get you through about 80% of the Certified LabVIEW Developer exam.
    4) If you have a question first search the examples for something tha
    t may help you. If you can not find an example that is exactly what you want, find one that is close and post a question along the lines of "I want to do something similar to example X, how can I modify it to do Y".
    5) Some of the greatest LabVIEW minds offer there services and advice for free on this exchange. If you treat them good, they can get you through almost every challenge that can be encountered in LV.
    6) If English is not your native language, post your question in the language you favor. There is probably someone around that can help. "We're big, we're bad, we're international!"
    Trying to help,
    Welcome to the forum!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Contract Release value is not updated with Limit item value

    We have SRM 4.0 with ECS scenario.
    Contract are created in SRM and replicated to ERP.
    If we create PO with Service line and Limit line using contract in both of these line items, contract Release value is getting updated only with Service line item value.
    But the contract Total value is the addition of Service and Limit value of PO.
    Why Contract Release value is not getting updated with Limit item value. Please help as early as possible.

    Hi Sandeep
    Yes. there are various reasons .upon your contract incorrect status and linkage not establised / or more attachment in SRM GOA.
    what type of contract are you using? GOA or CCTR
    If it is GOA - which version of SRM and service pack ?are you in ?
    If it is a GOA , BLAREL idoc might failed to post the release value in the SRM .
    How contracts are created material / mat group ?
    to fix or understand the issue, you need to recreate the issue.
    what is the ERROR in BLAREL in SRM idoc monitoring ?

  • I Just received the update to iTunes, when I I look at the screen I do not see the normal icons.  When I select movies I do not get the new downloads unless i select the list in the sub file. How do I get backto the old method of seeing and using iTunes??

    I Just received the update to iTunes, when I I look at the screen I do not see the normal icons.  When I select movies I do not get the new downloads unless I select the list in the sub file. How do I get back to the old method of seeing and using iTunes??

    I can tell you that this is some of the absolutely worst customer service I have ever dealt with. I found out from a store employee that when they are really busy with calls, they have third party companies taking overflow calls. One of those companies is Xerox. What can a Xerox call center rep possibly be able to authorize on a Verizon account?  I'm Sure there is a ton of misinformation out there due to this. They don't note the accounts properly or so everyone can see them. I have been transferred before and have asked if they work for Verizon or a third party also and was refused an answer so, apparently they aren't required to disclose that information. I spent a long time in the store on my last visit and it's not just customers that get the runaround. It happens to the store employees as well and it's beyond frustrating.

  • Decided to update iphone 4 to ios 5.1 and mid update it froze and the screen is black.  Phone does not respond to any combinations of home and power buttons, when plugged into computer it does not see it is plugged in, any ideas?

    Decided to update iphone 4 to ios 5.1 and mid update it froze and the screen is black.  Phone does not respond to any combinations of home and power buttons, when plugged into computer it does not see it is plugged in so I cannot restore or anything.  Looks like the screen is on it's just unresponsive and black obviously.  Has anyone had this problem?  I was updating via wifi right in front of my router and my computer.

    Spoke to a "senior advisor" in the Apple TV department.  Her suggestions:  change channel in router to minimize/eliminate wifi interference from other users; move router away from any metal - i.e., DVD player, phone modem, etc.; keep router away from wireless 2.4 gH phones, which are "notorious" for crashing wifi routers.  So she confirms that the problem is one of connection to router suddenly dropping out.
    My own feeling is that none of these fixes will do the trick, because it seems pretty clear that there is a hardware component here - the timing of the drops seems like an overheating issue.  It takes 35-40 minutes for the box to warm up enough for the first drop; then each consecutive drop happens quicker than the one before, as it heats up more.  Each time it drops, its tiny brain gets a little more scrambled; last night it finally wouldn't start up again at all.
    My suggestion is that everyone who is experiencing this problem, please call Apple tech support and ask to speak to a senior advisor in the Apple TV department.  Make them aware of this problem!

  • I updated to iTunes 10.7 and now iTunes does not see my iPod Touch.  It says the Apple Mobile Device USB Driver cannot be installed.

    I updated to iTunes 10.7 and now iTunes does not see my iPod touch.  After the update I got a message that the Apple Mobile Device USB Driver could not be installed.  I have uninstalled and reinstalled iTunes 3 times, but still cannot fix the problem.  I have followed the suggested fixes in Apple Support.   Any suggestions?  Thanks!

    Try the actions here for that driver.
    iOS: Device not recognized in iTunes for Windows
    I would first do this:
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7

  • Updated my iTunes and now my mac can not see my airport express no matter what I have tried

    recently updated my itunes and the firmware on my airport extreme and suddenly itunes does not recognize my airport express for speakers and my mac through airport utilities can not see my airport express. *** I have tried everything and nothing will bring the airport express back to life what to do

    rosenkd wrote:
    *** I have tried everything
    ... including a "hard reset" or a "factory defaults reset"?

  • I was doing OS5 help update iphone but now no longer connects to PC and iTunes does not see the phone

    I was doing OS5 help update iphone but now no longer connects to PC and iTunesdoes not see the phone

    Hold Sleep Button with Home Button toghether until it restarts Always it takes 8 to 15 seconds, after it restarts leave the sleep button and remember do not leave the home button it automaticlly switches to DFU mode.

  • In iOS 7.0.2, Appstore updates can not see updated apps

    Hi. i am using iPhone 4S with iOS 7.0.2.
    I am updating some apps when updates comes but when i look notification center , some times i can see updated apps in notification center and the problem is Appstore updates can not see in all items .And some times, there is no any blue point some times but.
    Is this bug?
    Second question is; when i use assistive touch, some times, notification center and control center can not work. What about you.
    Note: i installed in DFU mode and clean installed ios 7.

    Then readd the account.
    settings - mails - add - the account.

Maybe you are looking for

  • No audio from w2408h monitor

    I recently had to replace a m9150f desktop with a 500-214.  I was attempting to use the original 24" monitor but am unable to get sound from the built in speakers. Also had this problem in the past with the previous tower, but somehow it would correc

  • Multiple Controller GUI connection not working

    Hi, I have multiple WiSM's connected on the 6509 switch, sh wism stat will show me the all 4 management IP's, (two slots were powered on) I am able to connect 1st controller GUI and do all my configurations, but when I try to use GUI other management

  • Prepayment Vendor

    Hello, Can someone please explain how to use the prepayment functionality in ECC 6.0 How can I create an example and what I need to do in customizing. Kind Regards

  • Subcontracting return/rejection process

    Hi experts, My client is using subcontracting process in one of the plant which is excisable one .Some materials (assembly) gets rejected  in quality and is to be return to subcontractor with some challan and after rework from the subcontractor, the

  • Hyperion Interactive Support Required

    hi, my actual scenario is... In my cube am having four dimensions & one measure. 1st dim having totally ten generations 2nd dimension(having members present in dimension 1)i.e(duplicate members) four generations 3rd dimension three " 4th dimension th