Update data with subquery

Hi all,
I have two tables A(a1,a2,a3) and B(b1,b2,b3) then I want to update data
in column A.a3 to '4' where A.a1 = B.b1 and A.a2 = B.b2
How to write this update script?
Thank you,
Mcka

Hi Rodwest,
Thank you for your answer ,but can I use this script
update A
set A.a3 = 4
where (a1,a2) IN (select b1,b2
from B
where A.a1 = B.b1 and A.a2 = B.b2)
If can use, which one is better?
Thank you ,
Vilas

Similar Messages

  • Update data with CachedRowSet failed ! Help....

    I can select data from Oracle DBMS with CachedRowSet,However I can't update data with it.
    the Exception is :Cannot determine the table name
    Can anyone help me out with the
    above problem?
    my email is: [email protected]
    my codes are:
    Connection con = ds.getConnection();
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT * FROM T_XML_TEST");
    CachedRowSet crset = new CachedRowSet();
    crset.populate(rs);
    rs.close();
    stmt.close();
    System.out.println("name");
    while (crset.next()){
    System.out.println(crset.getString("name"));     
    try{
    crset.previous(); // or crset.absolute(4);
    crset.updateString("name","changed");
    crset.updateInt("layer",55);
    crset.updateRow();
    crset.moveToCurrentRow();
    crset.acceptChanges(con);
    catch(Exception e)
    System.out.println("update failed:"+e.getMessage());
    e.printStackTrace();     
    }

    Hey,
    Would you please let me know which JDBC driver you are using?
    Thanks!
    ~Ji

  • Update column with subquery returning more than one row

    Hi Everybody,
    Please let me know how to handle this. I am writing update statement in procedure with subquery and it is returning multiple rows. Please help me, how i can handle this :
    UPDATE TABLEA A
    SET A.ERROR_MESSAGE = (Select B.XERROR_MESSAGE from TABLEB B, TABLEA A WHERE B.id = A.id)
    WHERE A.id = (Select B.id from TABLEB B, TABLEA A WHERE B.id = A.id);
    (Select B.XERROR_MESSAGE from TABLEB B, TABLEA A WHERE B.id = A.id) --- This subquery is returning more than one rows. How i can handle this in Pl/SQL?
    Please let me know. I will be very thankful to you all.
    I will really appreciate your replies and comments.
    Thank you

    Try getting rid of tablea in your subqueries. You already have it in the UPDATE statement.
    UPDATE TABLEA A
    SET    A.ERROR_MESSAGE = (Select B.XERROR_MESSAGE
                              from   TABLEB B
                              WHERE  B.id = A.id
    WHERE  A.id = (Select B.id
                   from   TABLEB B
                   WHERE  B.id = A.id);You can also try a simple MERGE:
    merge into tablea a
    using tableb b
    on    (a.id = b.id)
    when  matched then update
          set a.error_message = b.xerror_message;

  • Update statement with subquery

    Hello:
    Can someone assist me with this, please.
    I'm getting subquery returned more than 1 value from the code below. I realize that Documentrecords_62 table will bring back multible rows and that's expected. For each row I need to do a carriage return, that's why I'm using CHAR(13) and CHAR(10).
    UPDATE Documentrecords_90
           SET Change_Descriptions =
                  (SELECT
                      CAST(ChangeNumber As  varchar(5)) + '     ' + 'WAS: ' +
                      CAST(TextBefore) As  varchar(100)) + '     ' + 'CHANGED TO: ' +
                      CAST(TextAfter As  varchar(100)) + CHAR(13) + CHAR(10) AS TEST
            FROM DOCUMENTRECORDS_62
            WHERE CHGPRODUCTCODE = '0382505' AND CHGREVISION = 'A'
             WHERE PARTPRODCODE = '0382505' AND REVREVISION = 'A'
    Thanks

    Saravana, thanks for responding.
    I tried the code below and I'm receiving the following error message:
    Row name '  ' contains an invalid XML identifer as required for by XML; '  '(0x0020) is the first character at fault.
    UPDATE Documentrecords_90
    SET Change_Descriptions =
    STUFF( (SELECT
    CAST(ChangeNumber As varchar(5)) + ' ' + 'WAS: ' +
    CAST(TextBefore) As varchar(100)) + ' ' + 'CHANGED TO: ' +
    CAST(TextAfter As varchar(100)) + CHAR(13) + CHAR(10)
    FROM DOCUMENTRECORDS_62
    WHERE CHGPRODUCTCODE = Documentrecords_90.PARTPRODCODE AND CHGREVISION = Documentrecords_90.REVREVISION
    FOR XML PATH(''),type).value('.','nvarchar(max)'),1,1,'')
    WHERE PARTPRODCODE = '0382505' AND REVREVISION = 'A'
    Best regards

  • Input/Update Data with JAPI

    Hi all.
    Anyone know any way to input/update the data on Essbase using JAPI.
    Thanks,
    Márcio Guedes

    Hey,
    Would you please let me know which JDBC driver you are using?
    Thanks!
    ~Ji

  • Inserting/Updating data pertaining to future or past

    I am considering to use OWM to implement several lookup tables that need to keep track of data versions over time.
    One of the requirements of the application is the capability to insert or update data at any point in time, but this data should only (automatically) be available for lookup at some future point in time.
    Similarly, I need the capability to insert/update data with an effective date at some point in time in the past.
    Is it possible to make data effective from some point in the future or past with OWM ?

    The current 9.2.0.3.0 release of Workspace Manager includes support for Valid Time.
    After enableversioning a table with the Valid Time option, you will be able to insert/update rows that are associated with a particular valid time range. A procedure, setValidTime, can be used to specify the interval for which rows are effectively inserted, updated, and deleted. This date interval can also be used to limit which rows are returned from a select query.
    The documentation for the 9.2.0.3.0 release includes all the additional information pertaining to valid time support.
    Ben

  • How to Query for last updated data in planning Cube?

    Hi,
    i want to see the last updated data with specific timestamp on one of our planning application Cube, IS it possible ?
    I have gone through application log and essbase server log but didn't get much information
    Can any one please let me know.
    Thx

    How was the data updated, if it was through planning then you can enabling data auditing and you should be able to then query the information.
    If it is was a data load then in EAS go the database, edit properties, modications, it should display data load information.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Update data from ODS to ODS with infopackage selection

    Hi,
    I am trying to update data from one ODS to another ODS with selection criteria in InfoPackage which is created manually.For Full load I can give selection criteria in InfoPackage. When I initialize data Selection is greyed out even selections for Full load exists. Please advise me how to give selections for delta loads from ODS to ODS loads.
    Thanks in advance.
    Ram

    Once you started an ODS as destination in FULL mode from a DS you cannot get back.
    So if you want to update from ODS to ODS using Change Log but considering only some data records you could create an Update Routine with a Start Routine that DELETES undesired records (e.g. DELETE DATA_PACKAGE WHERE ...) and then start an Init-Delta Loading.
    Hope it helps
    GFV

  • Cannot update data from DSO to Cube with further update in process chain

    Hi Guys,
                  This is the message am getting when am trying to update to cube by process further update with process chain.Process fails at further update with the following below message.
    However at DSO level i can see the data mart status but no request at cube level.
    Error Message:
    Cannot update request REQU_D57WAP7Z2WAI1CG5Y5OQ5W7JR in data target
        Message no. RSM1523
    Diagnosis
        System checks show that request REQU_D57WAP7Z2WAI1CG5Y5OQ5W7JR cannot be
        updated to a data target.
        The system checked whether
        o   request REQU_D57WAP7Z2WAI1CG5Y5OQ5W7JR is already in the data target
        o   the data target has active update rules for the InfoSource
        o   the data target was selected for updating
        o   locks exist
        o   for a DataStore object as a data target, that the request was
            updated in the correct order, if the DataStore object stipulates
    When i check the monitor screen under status tab it says "A caller 01, 02 or equal to or greater than 20 contains an error meesage" and under details tab "Data Package 1 : arrived in BW ; Processing : Data packet not yet processed "
    Regards,
    Krishna.
    Edited by: krishna Krishna on Mar 4, 2009 6:37 PM

    Hi
    It seems you used infopack when you select update data inot datatarget then system prompts you a infopack.That's the infopack which is generated by system being used in process chain variant to update data into datatarget.
    Create new infopack/ DTP manually then use that infoapck/DTP on the process chain variant then try.
    Chandu.

  • HT4623 I just bought an ipad form a friend. It says its up to date with iOS 5.1.1, but when I try to download apps it tells me I need to update to iOS 6.0 or newer but it wont let me

    My friend just sold me her ipad she got Jan 2013. The software says its up to date with iOS5.1.1, but when i try to download certain app it tells me I need to update to iOS6.0 or later but when i go to the setting there are no updates. so how do I add these apps? The person i bought it from doesnt know what generation becuase it was a present to her.

    The way you download older apps for the older, original iPad 1, as I understand it, is if you have iTunes installed on a computer, you purchase / download the new, current app, in the iOS App Store in iTunes on your computer. Then, go back to your iPad and go to the App Store app on your iPad and find the same app there and download it.
    When You select app to update/download, a message pop-up window appears asking if you want to download the last compatible version for your device (if one still exists ) tap OK and that should be it.

  • I have an iphone 4, i connect it to my laptop using the usb and then when connecting to itunes it says my phone is not up to date with itunes yet i cannot find an update 11.1 for my phones itunes? someone please help me.. kind regards

    i have an iphone 4, i connect it to my laptop using the usb and then when connecting to itunes it says my phone is not up to date with itunes yet i cannot find an update 11.1 for my phones itunes? someone please help me.. kind regards

    Itunes 11.1 is for your computer, not your iphone
    It is required in order to sync with ios 7.

  • When I try to open a Pages document from iCloud, created on my iPad, I get message stating I need a newer version of Pages.  When I go to app store all I get is "installed" when looking at pages app. my Macbook pro is up to date with all updates.

    When I try to open a Pages document from iCloud, created on my iPad, I get message stating I need a newer version of Pages.  When I go to app store all I get is "installed" when looking at pages app. my Macbook pro is up to date with all updates. Any ideas?

    You have 2 versions of Pages on your Mac.
    Pages 5 is in your Applications folder.
    Pages '09/'08 is in your Applications/iWork folder.
    You are alternately opening the wrong versions.
    Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
    Pages 5/5.01 can not open Pages 5.1 files and you will get the warning that you need a newer version.
    Pages 5.1 sometimes can not open its own files and you will get the warning that you need a newer version.
    Pages 5 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
    Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
    Anything that is saved to iCloud is also converted to Pages 5 files.
    All Pages files no matter what version and incompatibility have the same extension .pages.
    Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
    Apple has not only managed to confuse all its users, but also itself.
    Note: Apple has removed over 100 features from Pages 5 and added many bugs:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    Archive/trash Pages 5, after exporting all Pages 5 files to Pages '09 or Word .docx, and rate/review it in the App Store, then get back to work.
    Peter

  • I have Microsoft Office 2004 on my MacBook (2.4 GHz Intel Core 2 Duo).  It is currently up to date with Microsoft updates.  I am running Mac OS 10.6.8.  I just updated my Mac software with "Security Update 2012-001".  I am now unable to print (Epson NX510

    I have Microsoft Office 2004 on my MacBook (2.4 GHz Intel Core 2 Duo).  It is currently up to date with Microsoft updates.  I am running Mac OS 10.6.8.  I just updated my Mac software with "Security Update 2012-001".  I am now unable to print (Epson NX510 printer) from Excel or Word.  When I click on the Print menu item in Excel, there is a flash in the background like it is trying to open the print window, but nothing else.  I am able to print from other programs like TextEdit, Mail or KakeidaGraph.  As far as I know I have the latest Epson print driver.
    Also, I am also unable to open an existing Excel or Word file from the open menu - both programs lock up and do not respond.  I have to force quit.  After I restart Excel or Word I can open an existing file by double clicking on the file, but if I again try to open another file from the open menu, Excel or Word lock up.
    Any similar problems?

    Howdy,
    Apparently some are reporting that this causes the older PowerPC (PPC) applications that are supported in 10.6 via 'Rosetta' to crash upon attempting to open/save/print using any dialog box, or fail in other similar ways such as simply not printing or quitting, or freezing/hanging/crashing of the application.
    I have read of some companies that have indeed submitted proper bug reports to Apple, but that is not a guarantee of a bug-fix being issued.
    You might wish to read:
    http://www.macintouch.com/readerreports/snowleopard/index.html#d02feb2012
    If you are unsure if you are still using PowerPC apps, if the application is currently running, look under the 'Activity Monitior' (in Applications -> Utilities), or alternatively you could check in the System Profiler, Applications. Check the column "Type".
    Here is a fairly simple way you can restore you system and restore you applications functionality again, if you don't have a recent clone or good Time Machine backup that you can restore from. If you do, restore from your backup prior to having installed the Security Update 2012-001.
    Time Machine restore: http://support.apple.com/kb/ht1427
    If you are restoring a backup made by a Mac to the same Mac
    With your backup drive connected, start up your Mac from the Lion recovery partition (Command-R at startup) or Mac OS X v10.6 installation disc. Then use the "Restore From Time Machine Backup" utility. Select the backup prior to your issues, and it will be restored back to the state it was in at that time.
    If you can't easily restore from a backup, you can instead do the following:
    - You first start by reinstalling your OS X 10.6.x, this will preserve all your user data, your applications, no worries there.
    - Then install the Mac OS X 10.6.8 Update Combo v1.1 (links provided below)
    - Make sure you're printers are showing up correctly in your system preferences, if not, re-add the printers
    - Then finally, run the Apple Software Update (by pulling down the Apple Menu), and install any and all remaining updates, except do not then re-install the Security Update 2012-001. It is possible that you may have to reboot after installing some of the updates, and you may even need to run it a 2nd time to make sure that you've got all updates, except NOT the Security Update 2012-001.
    Links for 10.6.8 Update Combo v1.1:
    http://support.apple.com/kb/DL1399
    or the link to directly download this 1.09GB combo updater:
    http://support.apple.com/downloads/DL1399/en_US/MacOSXUpdCombo10.6.8.dmg
    Cheers,
    Daniel Feldman
    =======================
      MacMind
      Certified Member of the
      Apple Consultants Network
      Apple Certified (ACHDS)
      E-mail:  [email protected] 
      Phone:   1-408-454-6649
      URL : www.MacMind.com
    =======================

  • I recently purchased the iPhone 5 and my itunes account on my iMac 7,1 will not recognize it as a device. My imac has stopped downloading new updates, it says it is up to date with iTunes 9.2.1. My imac will not run the newest 10.7 itunes either. HELP!!

    I recently purchased the iPhone 5 and my itunes account on my iMac 7,1 will not recognize it as a device. My imac has stopped downloading new updates, it says it is up to date with iTunes 9.2.1. My imac will not run the newest 10.7 itunes either. All I want to do is put my music from itunes on my computer to my new phone. HELP please!!

    i called apple and they are sending me snow leopard so i should, *fingers crossed, be able to run the newer version of itunes. we'll find out for sure in a few days when it arrives

  • Use of "with master data & with out master data" at DTP update level

    Hello experts,
    In DTP, I check "with out master data". When I try to send corresponding transactional data, It is showing SID related error. Can anybody suggest what is the use of "with master data & with out master data" at DTP level.
    Thanks in advance,
    Zakir.

    HI
    HI in DTP level If you set this indicator, the system terminates the update of the request if no values are available for a data record.
    Load the relevant master data before you load the transaction data.
    If you set this indicator, the system terminates activation if master data is missing and produces an error message.
    If you do not set this indicator, the system generates any missing SID values during activation.
    In DataStore maintenance, if you do not set the SIDs Generation upon Activation indicator, the No Update without Master Data indicator in the DTP has no effect.
    thx
    vijju

Maybe you are looking for

  • Product Configurator tab missing in Sales Order in ICWC for complaints

    Hello Our environment - ECC 6.0 & CRM 6.0 We have variant config items created in ECC & downloaded to CRM via Knowledgebase & runtime versions. The customer service reps place the order via ICWC. Till now only standard sales orders were being created

  • What is the best practice for uninstalling only some CS4 programs (Win 7 PC)

    I recently upgraded from CS4 to CS5.5 and wanted to free up some hard drive space on my Windows 7 PC. I wanted to uninstall only a few programs though from CS4, such as Photoshop, Illustrator, Flash and Bridge. What is the best way to do this keeping

  • Get Email Address of Process Creator

    I have a requirement to, at the end of my workflow process, render the form as a PDF document which will be mailed back to the process creator. Is there some way to obtain the creators email address within my process so that I can accomplish this?

  • Web Center Suite/Oracle Content DB

    What is the role of Oracle Content Database in Webcenter Suite? Is that the default repository? I read a lot of documentation but no where it explains the connection. We are in the process of getting a licence for the Web center Suite. As per Oracle

  • So many errors for one 30-day-ish trial. Lovely.

    I'm constantly having quite a bunch of problems and errors all in an attempt to use a 30 day trial of Photoshop. This is all happening with the most recent version of the software, freshly downloaded from the Adobe website. I'll explain what I've bee