Update a column with info from columnA, and if not in columnA, then columnB

I have a situation where I have to update a columnC with information stored one of 2 ways. It is stored one way in ColumnA, and another way in columnB. I must check the string if it is in columnA first, and if it is, that value will go in columnC to be updated. If it is not, I must go on to columnB and find it there. It will be in one of the 2 columns but I must use the way it is stored in these columns to store in my columnC to be updated. The data is basically turned around (not reversed letter for letter, though) in the 2 columns and must be stored the way it is found in columnA or columnB. Any ideas?

It's that simple? It will look in both columns this way? Now, I actually mentioned UPDATE when I meant INSERT, so I am doing this in a VALUES clause? Will I just use the phrase 'nvl(A, B);'?

Similar Messages

  • Updating Oracle table with info from Sybase query

    I hope this is the correct forum for this question.
    I am fairly new to Java and JDBC. I am trying to figure out what the best method for updating information in Oracle tables with data from a Sybase table. I would prefer to use Oracle’s transparent gateway but this is not an option my company will pay for so I am creating a java stored procedure and using JDBC to connect to the Sybase database.
    The process I think I need to go thru is
    1.     Query an Oracle table to get the records that need to be updated and the “key” information to query the Sybase table with.
    2.     Use that result to query the Sybase database to get the fields that need to be updated in the Oracle table for those records.
    3.     Update the records on the Oracle table with the data from the Sybase query.
    I know I can just do this procedurally, row-by-row, but I was wondering if anyone knows of a way to accomplish this with SQL and no loops. Is there a way to make a result set available as a “SQL table” for another JDBC query?
    Basically what I would like to do is:
    OraQuery = “ select sybinfo from sometable where updated_date = null”;
    Statement orastmt1 = OraConn.createStatement();
    ResultSet Orars1 = orastmt1.executeQuery (OraQuery);
    SybQuery = “select update_date, sybinfo from sybtable where sybinfo = Orars1.sybinfo”;
    Statement sybstmt = SybConn.createStatement();
    ResultSet Sybrs = sybstmt1.executeQuery (SybQuery);
    OraUpdate = “update (select update_date from sometable, Sybrs where sometable.sybinfo = Sybrs.sybinfo) set update_date = Sybrs.update_date”;
    Statement orastmt2 = OraConn.createStatement();
    ResultSet Orars2 = orastmt2.executeQuery (OraUpdate);
    This may not be possible but if anyone has done something similar and wouldn’t mind sharing I would appreciate it. If there is a “better” way of accomplishing this I am open to suggestions.
    Thanks

    you can try using cachedRowSet() for the Oracle side query.
    The rows in this could be populated using the sybase side query's resultset and then all of this could updated into Oracle in one shot.

  • Creating 2D Array with info from file and Saving it to a text file

    what im trying to do is take my nice little data structure and put it into a 2D array which i can copy and paste as code into my compiler... it takes TDPoints(like Point2D except has z value) which are in Faces(an arraylist of points, each face also has a color value), which are in objects(arraylist of faces, + other attributes)
    for my sake im only working with one object, here is my code:
         private void saveArrayToTXT(String name) throws IOException
              double X;
              double Y;
              double Z;
              FileOutputStream xos = new FileOutputStream("C:/Program Files/Xinox Software/JCreatorV3LE/MyProjects/ThreeDRemake/Files/" + name + ".txt");
              DataOutputStream fos = new DataOutputStream(xos);//ObjectOutputStream oos = new ObjectOutputStream(fos);
              //oos.writeObject(myObject);
              //for(int ob = 0; ob < ((ArrayList)myObject).size(); ob++)
                        ThreeDObject object = (ThreeDObject)(((ArrayList)myObject).get(0));
                        fos.writeChars("{");
                        for(int shape = 0; shape < object.getFaces().size(); shape++)
                             fos.writeChars("{");
                             ArrayList faces = object.getFaces();
                             for(int count = 0; count < ((Face)(faces.get(shape))).getPoints().size(); count++)
                                  X = ((TDPoint)(((Face)(faces.get(shape))).getPoints().get(count))).getX();
                                  Y = ((TDPoint)(((Face)(faces.get(shape))).getPoints().get(count))).getY();
                                 Z = ((TDPoint)(((Face)(faces.get(shape))).getPoints().get(count))).getZ();
                                   fos.writeChars("" + (int)X);
                                   fos.writeChars(",");
                                   fos.writeChars("" + (int)Y);
                                   fos.writeChars(",");
                                   fos.writeChars("" + (int)Z);
                                   if(count != ((Face)(faces.get(shape))).getPoints().size()-1)
                                   fos.writeChars(",");
                                   if((count == ((Face)(faces.get(shape))).getPoints().size()-1) && (count < 5))
                                        for(int lkj = count; lkj <5; lkj ++)
                                             fos.writeChars(",");
                                             fos.writeChars("" + (int)X);
                                             fos.writeChars(",");
                                             fos.writeChars("" + (int)Y);
                                             fos.writeChars(",");
                                             fos.writeChars("" + (int)Z);
                              fos.writeChars("}");
                         fos.writeChars("}");
              fos.close();
              xos.close();
         } i happen to know for a fact that there are no faces with more than 6 points, so i used this line:if((count == ((Face)(faces.get(shape))).getPoints().size()-1) && (count < 5))and everything that follows to write ditto information(the last point) over and over again to fill up the array(i could even write a null value here if i wanted)
    the problem im having is i seem to be missing two right brackets("}") and with all the information thats going through these loops its impossible to trace where and what is going wrong. can anyone point out any possible flaws to help me figure out what im doing wrong??
    Message was edited by:
    sosleepy
    also, though its not important, when i do:fos.writeChars("...")//(i used writeChars(); to save myself the hassle of typeing writeChar((int)'char').)it writes a blankspace(spacebar) between each string i write, how can i prevent this from happening?
    Message was edited by:
    sosleepy
    nvm i just realized what i was doing wrong... fixed the error, but a reply on the spaces between writes would be nice

    You asked this same question a couple of months ago: http://forums.ni.com/t5/LabVIEW/Reading-Data-From-text-File/m-p/1756390#M612805
    Well, you can use the Read Text file to read the file, and then just extract the lines... Ben64 showed you a method to use regular expressions. That's one way.
    For Excel you can use the Report Generation Toolkit, or you can code it yourself using ActiveX. There's an example that ships with LabVIEW on writing a table to Excel.
    For database operations you can use the Database Toolkit, or you can try to use LabSQL.

  • Update Rows with info from other Rows in Same Table.

    I'm trying to update rows with information from the same table. The table gets loaded with info from a report that runs and it has to be a new entry every month but I would like to carry over some of the info from last month. This statement below runs but updates all rows in the new table load and in my test cases I only made a few match so only like 5 records should get updated. This is an example of what I'm trying to do. If I add this(C2.COL_INVC_ID = C1.COL_INVC_ID) to the last "*Where*" statement I get an invalid identifier for "C2.COL_INVC_ID". So what am I doing wrong here??? How can I update only the rows that where also in last months run???
    Thanks in advance for any help!
    Update OpenIssues OI1
    Set(OI1.Num, OI1.Status, OI1.Code, OI1.LastModifiedDate) =
    (Select OI2.Num, OI2.Status, OI2.Code, OI2.LastModifiedDate
    From OpenIssues OI2
    Where OI2.num = OI1.num and OI2.TableLoadDate = TO_DATE('01/31/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
    Where and OI1.TableLoadDate = TO_DATE('02/29/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
    SQLMe

    Hi,
    Welcome to the forum!
    SQLMe wrote:
    I'm trying to update rows with information from the same table. The table gets loaded with info from a report that runs and it has to be a new entry every month but I would like to carry over some of the info from last month. This statement below runs but updates all rows in the new table load and in my test cases I only made a few match so only like 5 records should get updated. This is an example of what I'm trying to do. If I add this(C2.COL_INVC_ID = C1.COL_INVC_ID) to the last "*Where*" statement I get an invalid identifier for "C2.COL_INVC_ID". If the aliases c1 and c2 aren't defined anywhere, then you can't use them anywhere.
    The WHERE clause of the UPDATE statement can only reference the table being updated, ot1 in this case.
    So what am I doing wrong here??? How can I update only the rows that where also in last months run???
    Thanks in advance for any help!
    Update OpenIssues OI1
    Set(OI1.Num, OI1.Status, OI1.Code, OI1.LastModifiedDate) =
    (Select OI2.Num, OI2.Status, OI2.Code, OI2.LastModifiedDate
    From OpenIssues OI2
    Where OI2.num = OI1.num and OI2.TableLoadDate = TO_DATE('01/31/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
    Where and OI1.TableLoadDate = TO_DATE('02/29/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
    ------------There's a syntax error in the last line. Either something got lost when you posted the code, or you just don't want the keyword AND. You certainly don't want AND immediately after WHERE.
    In general, if it's not obvious how to do an UPDATE, then UPDATE is the wrong tool: you want MERGE instead.
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Simplify the problem as much as possible. Remove all tables and columns that play no role in this problem.
    If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results will be the contents of the changed table(s) when everything is finished.
    Always say which version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • I attempted to update my iphone5 to 7.1.1  There was an error and now my phone is erased.  I have attempted to restore from the cloud and it propogates the apple id with an old one, and will not allow me to restore from a the cloud

    I attempted to update my iphone5 to 7.1.1  There was an error and now my phone is erased.  I have attempted to restore from the cloud and it propogates the apple id with an old one, and will not allow me to restore from a the cloud

    Try:                                               
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable       
    - Try on another computer                            
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
      Apple Retail Store - Genius Bar                              
    Also, do you remember what the error message said?

  • IPod updates 2 touch with the new software, and from the update they are not connected with Time phase. They appear calling but never they enter the calls. I make calls with other users and if one connects but in these two not from the update

    iPod updates 2 touch with the new software, and from the update they are not connected with Time phase. They appear calling but never they enter the calls. I make calls with other users and if one connects but in these two not from the update

    I use Firefox 95% of the time, and there's no problem with flash content (and I'm still at .55 - downloaded .64 last week but I haven't got round to making the change yet). At the rate they've been changing it recently it may well be out of date already .
    I've been trying it in Safari, too with no problems apart from You Tube, but that's because I'm blocking Google cookies.
    One thought does occur - if your Flash preferences are set to block all Local Storage, it may be that the problem site is trying to use Flash cookies (LSOs). I had this problem recently with the BBC iPlayer streaming content. Little Snitch notified an attempt to connect to a new URL - emp.bbci.co.uk.
    If I disallowed it, no streaming; when I allowed the connection, it still wouldn't stream, so I did a bit of digging and came to the conclusion that it was trying to set a Flash cookie. When I unblocked, lo and behold - streaming resumed as normal.
    I now have LSOs blocked in a more subtle way that lets the site think it's being set (but it ain't) and the streaming still works.
    As for permissions repair - always repair from local; the permissions on the original disc will have been superceded by updates and new installations of Apple software.
    DU needs to be reading the packages on the HD, not the (now out of date) install disc.
    The recurring repair messages are normal and don't mean anything's wrong. As long as the final message is 'repair complete' there's no need to dwell on it.
    http://support.apple.com/kb/TS1448 (for Leopard and Snow Leopard - Lion no doubt has it's own set).

  • I need to update my phone, but my computer broke, and do not have a new one. I have an Itunes account, can I use someone else computer to go through with the update?  Is there a chance of loosing all my data, ie: music/photos?

    I need to update my phone, but my computer broke, and do not have a new one. can I use someone else computer to go through with the update if i log on with my itunes account or Is there a chance of loosing all my data, ie: music/photos? And if all else fails can i go to the apple store and have them update my phone?

    Update to what? The 3G you want to update? You have ios3 or 4 on that 3G?
    Go to a friend, authorize that pc.
    Read this : http://support.apple.com/kb/ht1848
    and this : http://support.apple.com/kb/ht2519
    Make a backup of your stuff (from the phone. apps/photos/music/blabla). Update your phone. The phone will restore the backup automatically.

  • HT204150 one of my friend updated her iPhone with my apple id and now her contacts are inside my iPhone , she has deleted my contact which has been i her contact , how can i bring back my contact ?

    one of my friend updated her iPhone with my apple id and now her contacts are inside my iPhone , she has deleted my contact which has been i her contact , how can i bring back my contact ?

    Welcome to the Apple Community.
    The first thing you should do is have your friend log out of your account and change your password.
    Do you have a back up from when you had the contacts on your phone.

  • I updates my iPad with the latest iOS and despite backing up all the information prior, my iBooks application was deleted along with a hundred important PDFs on it. Is it possible to locate these missing files? Urgently requires assistance. Thank you!

    I updated my iPad with the latest iOS and despite backing up all the information prior via iTunes, my iBooks application was deleted along with a hundred important PDFs on it. Is it possible to locate these missing files? Urgently require assistance. Thank you!

    Hi Sam,
    I understand where you are about being your own IT department, it can be overwhelming ...
    What drives to buy depends an awful lot on how you will use them, what your budget is, and your preferences.
    In the case of your DP Powermac, for online storage used primarily for editing, I would add one or more internal drives first. Look for drives that are at least 7200rpm and have at least an 8MB cache. 10,000rpm/16MB cache is even better, but more expensive. Seagate Barracudas have always been good choices.
    For backup purposes, I'd pick some good external FireWire drives; you can also use these for online editing, lots of people do. Your Mac has both FW400 and FW800 ports - either kind is fine but if you get drives that support both, you would want to connect them to the FW800 port for the added performance.
    In my experience, the Lacie d2 Extreme drives have been very very good. In fact I have 3 of them daisy-chained off my iMac G5 right now and they work flawlessly with FCE. Weibetech and Granite Digital drives are further upscale in performance and price. RAID configurations would be even further upscale. Do stay away from consumer level hard drives, however ... the Western Digital MyBook series & no-name drives come to mind ...
    Don't use a FireWire hub for your external drives, it's just asking for trouble.
    ps. And thanks for your nice comment about me. I'm happy to help, as are other folk in the forum.

  • Hi...my last updating software was with 4.2.1 and today I updated new software 4.3.5 and im not happy with more strong vibration ,Can apple consider it  and restore the previous settings of vibration.Thank you

    Hi...my last updating software was with 4.2.1 and today I updated new software 4.3.5 and im not happy with more strong vibration ,Can apple consider it  and restore the previous settings of vibration.Thank you

    Apple isn't here.
    This is a user to user forum.
    Allan

  • Ever since updating my iPad with the iOS 8 and 8.0.2 it has been much slower in every way. Any suggestions besides restoring to last iOS?

    Ever since updating my iPad with the iOS 8 and 8.0.2 it has been much slower in every way. Any suggestions besides restoring to last iOS?

    Hi Arianelleangel,
    Welcome to the Support Communities!  If you are having issues trying to update your Aunt's iPad, the troubleshooting steps below may help:
    Resolve issues with an over-the-air iOS update - Apple Support
    Update does not complete
    If you're installing the update and the progress bar appears to move slowly, be patient. The time an update takes depends on the size of the update and the number of files on the device.
    When you're updating over the air, keep your device connected to a power source so that it doesn't run out of power. If your device does run out of power, connect it to a power source and turn on the device to let the update or restore complete.
    If the update never completes and the progress bar hasn't moved for an extended time, try restarting your device. If you still see the issue after you restart, see what to do if your device appears frozen or won't start.
    I hope this information helps ....
    - Judy

  • [svn:osmf:] 13083: Updated MASTAdapter class with new trait names and events.

    Revision: 13083
    Revision: 13083
    Author:   [email protected]
    Date:     2009-12-17 16:10:05 -0800 (Thu, 17 Dec 2009)
    Log Message:
    Updated MASTAdapter class with new trait names and events.
    Modified Paths:
        osmf/trunk/plugins/MASTPlugin/org/osmf/mast/adapter/MASTAdapter.as
        osmf/trunk/plugins/MASTPluginIntegrationTest/src/org/osmf/test/mast/TestMASTPluginInfo.as
        osmf/trunk/plugins/MASTPluginIntegrationTest/src/org/osmf/test/mast/adapter/TestMASTAdapt er.as

    Silviu!
    I'm really sorry, but as all the office is trying to fix the problem, someone replaced the url content with the stuff that was pointing to the local machine.
    I've fix it, and the video player is available here again: http://pp.player.webtv.flumotion.com/params/apiKey/5PzLR2ULL3z2rumJ/videoId/60
    If there are other references to the localhost, please do not bother with them, as they do not affect player functionality.
    The stream that it uses is an RTMPE, so i'm afraid it will only works with this player. Anyway, the stream url is as follows: rtmpe://87.248.205.81/a4349/e2/veo7/ondemandrtmpe/mp4/med/first-person-mario-4d8741aa.mp4
    I really appreciate your help!
    Thank you!

  • I have purchased Iphone 4 from US and its not having sim in it and rt now when i have updated this to io5 ,it is showing "sim card inserted in iphone is not supported" and i am not able access aything."

    I have purchased Iphone 4 from US and its not having sim in it and rt now when i have updated this to io5 ,it is showing "sim card inserted in iphone is not supported" and i am not able access aything."
    Earlier i was able to use all application in this using IOS 5.0.1.
    I have format it and after that i am not able to use it.
    How to restore my itunes to 5.0.1???

    Well, welcome to the world of "hacked" phones. If your purchase was from the US, you obviously purchased an iPhone that is locked to a US carrier. The iPhone must have been jailbroken and unlocked via software to accommodate your foreign SIM card. Now that you have updated the phone, it is locked back to the US carrier. Only the carrier can authorize Apple to unlock the iPhone and none of the US carriers will unlock the iPhones. Best suggestion is to sell the phone and obtain a factory unlocked version directly from the Apple store.
    To answer your other question, there is not a supported method to downgrade iOS.

  • I updated my iPad with 8.0 ISO and now 2048 game is super slow...help!!!!

    I Updates my iPad with ISO 8.0 and now is is acting up...for instance game 2048 is super slow!!!! Can anyone help?

    iPad running slow? How to speed up a slow iPad
    http://appletoolbox.com/2012/07/ipad-running-slow-how-to-speed-up-a-slow-ipad/
    If You Think iOS 7 Feels Slow Here’s How to Speed It Up
    http://osxdaily.com/2013/09/23/ios-7-slow-speed-it-up/
    You may have many apps open which can possibly cause the slowdown and possibly the loss of wifi. In iOS 4-6 double tap your Home button & at the bottom of the screen you will see the icons of all open apps. Close those you are not using by pressing on an icon until all icons wiggle - then tap the minus sign. For iOS 7-8 users, there’s an easy way to see which apps are open in order to close them. By double-tapping the home button on your iPhone or iPad, the new multitasking feature in iOS 7-8 shows full page previews of all your open apps. Simply scroll horizontally to see all your apps, and close the apps with a simple flick towards the top of the screen.
     Cheers, Tom

  • HELP! An update wiped out all info from my iPhone. Now Game Center doesn't recognize me! Why?

    HELP! An update wiped out all info from my iPhone. Now Game Center doesn't recognize me! Why?

    Restore the device from the backup created prior to the update.

  • HT4623 i updated my ipad with ios7 but the keyboard does not work as it should hit the letters it is slow and does not click as it should

    updated my ipad with ios7 but the keyboard does not work its slow when i hit the letters does not click did not do this until i updated anyone can help me on this to fix it

    Settings>General>Reset>Reset All Settings

Maybe you are looking for