Value disappears when performing Update

Hello.
Please advice about the following:
I am running Update statement for 2 columns, for one of them I am giving
the value by myself:
update Table1 f
set (f.Value_Field, f.name1)
=
(select '1', k.name
from Table2 k where k.field1=f.field1
and k.field2=f.field2);
Then I run other statement, with different logic:
update Table1 f
set (f.Value_Field, f.name2)
=
(select '2', k.name
from Table2 k where k.field1=f.field1
and k.field2 <> f.field2);
The second update is working fine, updating the relevant records.
But for some reason the value '1' of previous Update statement disappears... What can be the reason?
I am using COMMIT after each query...
Thanks!

To be really explicit about what everyone is saying, your first statement updates every row in table1. If there is a corresponding row in table 2 based on a match of field1 and field2, it will set the values of value_field and name1 to the result of the sub-query. If there is no matching row, then both value_field and name1 will be set to NULL.
Your second query work similarly, seting value_field and name1 to NULL if there is no matching row. Minimally, your second update needs to be more like:
UPDATE table1 f
SET (f.value_field, f.name2) = (SELECT '2', k.name
                                FROM table2 k
                                WHERE k.field1 = f.field1 and
                                      k.field2 <> f.field2)
WHERE EXISTS (SELECT 1
              FROM table2 k
              WHERE k.field1 = f.field1 and
                    k.field2 <> f.field2);and probably your first needs to be:
UPDATE table1 f
SET (f.value_field, f.name1) = (SELECT '1', k.name
                                FROM table2 k
                                WHERE k.field1 = f.field1 and
                                      k.field2 = f.field2)
WHERE EXISTS (SELECT 1
              FROM table2 k
              WHERE k.field1 = f.field1 and
                    k.field2 = f.field2);HTH
John

Similar Messages

  • My previous session disappeared when I updated, how can I get it back?

    My previous session disappeared when I updated, how can I get it back?

    If you go to the History menu, is "Restore Previous Session" available? You can check that either:
    * "3-bar" menu button > History
    * classic menu bar: History
    If it's grayed out, then that's a bad sign.
    Do not close Firefox. First, try to rescue the following files:
    Open your current Firefox settings (AKA Firefox profile) folder using either
    * "3-bar" menu button > "?" button > Troubleshooting Information
    * (menu bar) Help > Troubleshooting Information
    * type or paste about:support in the address bar and press Enter
    In the first table on the page, click the "Show Folder" button.
    In the window that launches, scroll down:
    (1) Double-click into the '''sessionstore-backups''' folder. Anything from the relevant date/time? If so, copy it to a safe location such as your Documents folder or Desktop.
    (2) Back at the main level, scroll down to the sessionstore file(s). Same question. If so, copy it to a safe location such as your Documents folder or Desktop.
    The kinds of files you may find among your sessionstore files are:
    * sessionstore.js and recovery.js: the windows and tabs in your currently live Firefox session (or, if Firefox is closed, your last session)
    * recovery.bak: a backup copy of recovery.js
    * previous.js: the windows and tabs in your last Firefox session; sessionstore.bak for pre-33 versions of Firefox
    * upgrade.js-''build_id'': the windows and tabs in the Firefox session that was live at the time of your last update; sessionstore.bak-''datetime'' for pre-33 versions of Firefox
    If you come up with something promising, you may be able to have Firefox use it for your next session (details if relevant).

  • Iphoto disappeared when I updated to OS X Yosemite - help!

    iphoto disappeared after I updated to Yosemite. When I spotlight search it, I'm alerted my version is incompatible with Yosemite, and need to update. When I go to update, I'm told this version isn't available yet in my country (USA). The app and all my non-backed up photos are gone... how do I recover this?

    1. First make a back up:
    Most Simple Back Up:
    Drag the iPhoto Library from your Pictures Folder to another Disk. This will make a copy on that disk.
    Slightly more complex: Use an app that will do incremental back ups. This is a very good way to work. The first time you run the back up the app will make a complete copy of the Library. Thereafter it will update the back up with the changes you have made. That makes subsequent back ups much faster. Many of these apps also have scheduling capabilities: So set it up and it will do the back up automatically.
    Example of such apps: Chronosync - but there are many others. Search on MacUpdate or the App Store
    2. Download the App:
    Go to the App Store and check out the Purchases List. If iPhoto is there then it will be v9.6.1
    If it is there, then drag your existing iPhoto app (not the library, just the app) to the trash
    Install the App from the App Store.
    Sometimes iPhoto is not visible on the Purchases List. it may be hidden. See this article for details on how to unhide it.
    http://support.apple.com/kb/HT4928
    One question often asked: Will I lose my Photos if I reinstall?
    iPhoto the application and the iPhoto Library are two different parts of the iPhoto programme. So, reinstalling the app should not affect the Library. BUT you should always have a back up before doing this kind of work. Always.

  • The green drop down bar for tracker blocking disappeared when Firefox updated today, how do I get it back?

    This feature that helps to block ad and social network tracking appeared on the last update, it had a green drop down where I could then get a screen showing the number of tracking that are blocked, not blocked and could block the ones that weren't. Today when Firefox updated it disappeared. I do have the TrackerBlock addon installed, but I found the drop down helpful and would like to get it back.

    Sometimes an icon will get removed from the toolbar by another extension. Could you check the Customize dialog to see whether the missing icon is in there? This article has the steps: [[Customize Firefox controls, buttons and toolbars]].

  • The headers of the frameworks disappear when I update to OS Maverick.

    I have been working with some Bluetooth low energy applications so I am using IOBluetooth framework. Normally this framework is located in /System/Library/Frameworks and It has a folder call Headers with all the .h files.
    I need this folder because I am using this like a shared library in Labview and suddenly when I update my OS, that folder disappeared.
    I was looking for other options and I saw that I can found the hold framework inside XCODE app, but It does not work as the normal one.

    I get it now.
    There is a difference between frameworks in system locations and those in the SDK. The ones in system locations may not have any headers included. They are only there for the shared library portion. When you include the headers in Xcode, you are able to make a connection to the methods in the SDK version of the library. When the app is installed on a user's machine, all that is required is the dynamic library in the expected location.
    You compile and link against the headers in the frameworks for your targeted platform and OS version. You can target anything that is listed in Xcode. But at runtime, you can only run what is in /System.

  • Field value disappeared when saved in Quick Sales Order form

    HI,
    We have developed a custom form which is similar to the Find Customer Search form in Quick Sales Order form (Navigate to Tools --> Find Customer).
    The custom form searches Customer and populates the selected customer details in Quick Sales Order form (populating the values in Quick Sales Order form is handled in Custom.pll).
    When we select Bill to or Ship to Contact in the Quick Sales Order form and save the Order, the Bill to and Ship to Contacts are disappeared (If the Bill to and Ship to Sites are not Primary).
    Can anyone please help me on this...
    Thanks.

    Check if 'Audit Trail' is setup in OM Parameters for the OU.
    Also check if "Processing Constraints" are setup correctly.
    For Qty reduction we need to add a new row called "delete".
    Thanks
    -Arif.

  • Microsoft Access - error when performing updates

    Hi,
    I am creating a Java application that edits databases using a GUI. I am having problems when it comes to editing Access Databases. Every so often, when the user tries to perform an update like add an attribute the database throws the following exception...
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] The database engine could not lock table 'Books' because it is already in use by another person or process.
    This exception does not make sense since i DO NOT HAVE ANY OTHER APPS OPEN USING THIS DATABASE. Also it allows me to make some changes before throwing this exception.
    I dont get this problem when editing Postgres Databases.
    I am using the ODBC:JDBC drivers for connection to the access database. Could it be a problem with this driver.....
    (I posted this topic on JDBC forum but go no response...hoping for better luck here)
    Wide :)

    Couple of ideas......
    1) are you releasing your connections, statements and resultsets after use ? Best to wrap your code in at least a try - finally block.
    In finnally call resultSet.close(), statement.close() and connection.close() when you're finished. Maybe your db connections aren't being released.
    2) if autocommit was off, then previous uncommitted statements might conflict/lock the table ?
    regards,
    Owen

  • How do I retrieve lost Bookmark icons most of which disappeared when I updated to Firefox 8?

    After I updated to Firefox 8 I noticed that more than half of the itemsin my bookmarks list had lost their icons which were replaced by a dotted line in the shape of a square. I tried to go back to using Firefox 7 using System Restore. The restore was successful except that Firefox could not be opened. So I undid the restore and this allows Firefox to open and all seems ok apart from the fact that the majority of the items in my Bookmark list have disappeared and have been replaced as described. Can anybody help?

    Hi everyone. At issue is that FF8, obviously due to a coding bug, no longer is retrieving the favicon from the root of a website's www directory website in some situations. I tried starting FF8 with all add-ons disabled, just to verify that an add-on wasn't causing the issue. The add-on Check Places will restore the missing favicons, but the favicon will disappear as soon as you visit the bookmarked URL if the favicon was missing after you upgraded to FF8.
    Hehe. I am not too thrilled with Mozilla's new rapid development cycle. FF8 is simply a tweaked version of FF7 and as such it should have been a 7X upgrade. But I guess Mozilla wants Firefox to get up to version 10000 before Chrome does. Silly.

  • Using datasources: How to manage transactions when perform. update/insert?

    I've been trying to find information on how datasources manage transacctions but I've been unable to find much information. I've read that for XA datasources you dont have to commit, save and rollback manually, but how are transactions managed for non-XA datasouces?+ I've only seen examples with select statements, such as in the example on this page [this page|http://developers.sun.com/jscreator/reference/techart/2/jdbc.html], but I've never seen a working example with insert and updates.
    Can anyone point me to some examples?*
    Also, when I use the DriverManager instead of the DataSource for doing updates/inserts I use the setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE) method. Can that be used with datasources?+
    Thank you <img class="emoticon" src="images/emoticons/laugh.gif" border="0" alt="" />

    If you are using a connection pool, how are you guaranteeing that you are using the same connection throughout the same application? Look at the following:
    1) You grab a connection from the pool
    2) You call procedure A
    3) You call procedure B and issue rollback in procedure
    4) You call procedure C
    5) You close your connection
    Are you saying you made changes in procedure A and when you issued a hard rollback in procedure B, the changes in A were not rolled back?
    I'm guessing the problem is that you are not issuing your statements using the same connection.

  • Problem with JPA + Hibernate Validator when performing update

    When I try to insert an new entity with a validation problem, Hibernate Validator works normally, but when I try to update an entity the InvalidStateException is not thrown when persist() is called, so when commit() is called a RollbackException is thrown.
    I'm using the latest versions of the hibernate libraries. The problem happened with JSF(NetBeans 6 VWP) and Java SE.
    Sample code:
          EntityManagerFactory emf = Persistence.createEntityManagerFactory("HibernateValidatorTest");        
          EntityManager em = emf.createEntityManager ();       
          ScfaqAssunto assunto = em.find(ScfaqAssunto.class, 2); // new ScfaqAssunto() works normally
          assunto.setAssunto(""); // the property assunto is with @NotEmpty              
          try
             em.getTransaction().begin();
             em.persist(assunto);
             em.getTransaction().commit();
          catch(InvalidStateException e)
             if( em.getTransaction().isActive())
                em.getTransaction().rollback();
             for(InvalidValue invalidValue : e.getInvalidValues())
                System.out.println (invalidValue.getMessage());
          catch(Exception e)
             if(em.getTransaction().isActive())
                em.getTransaction().rollback();
             System.out.println(e.getMessage());
          finally
             em.close();
          } Thanks for any help,
    Felipe

    Hi Thomas
    I loose hours with this problem
    there is a problem with toplink lib version
    just download toplink librairies at http://www.oracle.com/technology/products/ias/toplink/jpa/index.html
    replace oldest in $Glassfishdir\lib
    It have to works
    tested on postGres and Derby
    Can netbeans update center fix this problem?

  • Why did my PDFs disappear when I updated to iBooks 3 on my iPad 1?

    I only had a handful of regular books from the bookstore, but I had *a lot* of PDF software manuals, camera manuals, etc sorted and organized in my library as well. I found the books under "purchased", but the PDFs are gone with the wind. Trust me, I never deleted them. I use them fairly regularly, or at least I did until now. When the iBooks update came through, there was nothing that said I needed to backup everything first. I thought it was just another app update. What the frack?

    I have PDF files in iBooks as well but didn't lose any during the update.
    Have you tried restarting or resetting your iPad?
    Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after the iPad shuts down, then press the On/Off button until the Apple logo appears.
    Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds). Ignore the "Slide to power off".

  • TS1702 My u tube app disappeared when I updated to 6 what can I do to get it back

    How do I get u tube app back diapered when updated to 6

    There is No Pre-installed Youtube App in iOS 6.
    http://itunes.apple.com/app/youtube/id544007664?mt=8

  • Compression getting disabled when performing Update on partitioned tables

    Hi All,
    I am on Oracle Database 11g Enterprise Edition Release 11.2.0.3.0.
    My question is related to Oracle Compression.
    I have a sub-partitioned table enabled with Basic Compression. In enabled compressed state, I am updating few columns of this table(Normal Update command and Merge as well) but the end result shows increase in the table size and the compression is still in ENABLED state. Post that, if I compress the sub-partition explicitly the table comes back to its original size.
    Is it a bug? I read a white paper on 11g itself, that compression remains enabled in case of all DML operations, then why this behaviour?
    Thanks,
    Ishan

    Ishan,
    taking a look at http://docs.oracle.com/cd/E11882_01/server.112/e25494/tables.htm#CJAGFBFG It seems that the distinction between OLTP and basic compression is sometimes a little bit vague ("Operations that permit compression include: ..."), but I can also find the statement "Rows inserted without using direct-path insert and updated rows are uncompressed." So I would say it's not a bug but a limitation of the feature. Updates just don't mix well with compression.
    Martin

  • TS3212 Old version of itunes can not be removed when performing update

    Unable to uninstall old version of iturnes telling me that feature that I an trying to use is on a network resource that is unavailable.  Itunes will not reconize my i pod without new itunes version.  Any help please.

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • Photos disappeared when i updated the app

    Soooo i could not enter to iphoto because i hadn't purchased the new update of this application and it appeared a lock sign above it. Once i updated iPhoto via App Store, i realized that all my folders were deleted with all my photos in them. What can i do to get my photos back i the app was not linked with iCloud?

    Obvious answer: Restore from the back up you made before upgrading.
    If that's not possible: Is there an iPhoto Library in your Pictures Folder? What size is it?

Maybe you are looking for