How to replace name with number ID

Example:
Table1
T1ID Name1
1 John Smith
2 Kathy Smith
Table2
T2ID Name2
100 John Smith
101 Kathy Smith
102 John Smith
103 Kathy Smith
I want to replace all names in column called Name2 in Table 2, with matching T1ID from Table 1. There are many name repetitions in Table 2.

If Name2 is VARCHAR and T1id is number then it would be better to add a new column with a consistent data type;
Sample data;
create table table1 as (
select 1 t1id, 'John Smith' name1 from dual union all
select 2, 'Kathy Smith'from dual);
Table created
alter table table1 add constraint table1_pk primary key (t1id);
Table altered
create table table2 as (
select 100 t2id, 'John Smith' name2 from dual union all
select 101, 'Kathy Smith' from dual union all
select 102, 'John Smith' from dual union all
select 103, 'Kathy Smith' from dual);
Table createdAdd the new column;
alter table table2
   add name_id references table1(t1id);
Table alteredUpdate the new column;
merge into table2 t2
using (select t1id, name1
       from table1) t1
on (t2.name2 = t1.name1)
when matched then
  update
  set t2.name_id = t1.t1id;
DoneDrop the retired column;
alter table table2 drop column name2;
Table altered
select * from table2;
      T2ID    NAME_ID
       100          1
       101          2
       102          1
       103          2

Similar Messages

  • Why does iPhoto (9.0/11) not retain the Event name when exporting more than one event? (using File - Export - Album name with number).

    Why does iPhoto (9.0/11) not retain the Event name when exporting more than one event? (using File -> Export -> Album name with number).
    Exporting a single Event retains the Event name which is what I'd expect. But highlighting more than one event and exporting it renames the images to Events 001.JPG, Event 002.JPG etc.
    I was recently on holidays and had all my events nicely split on Dad's computer but when I went to export it I couldn't retain any of this information. Now I have to replicate this all again on my computer.
    It wasn't possible to export the entire library as the external drive was fat32 format an I didn't want all of it. It would be nice to export a bunch of events to someone and have it retain the name.
    Does anyone have a work around or will this be fixed at some point by Apple?

    Why does iPhoto (9.0/11) not retain the Event name when exporting more than one event? (using File -> Export -> Album name with number).
    Exporting a single Event retains the Event name which is what I'd expect. But highlighting more than one event and exporting it renames the images to Events 001.JPG, Event 002.JPG etc.
    I was recently on holidays and had all my events nicely split on Dad's computer but when I went to export it I couldn't retain any of this information. Now I have to replicate this all again on my computer.
    It wasn't possible to export the entire library as the external drive was fat32 format an I didn't want all of it. It would be nice to export a bunch of events to someone and have it retain the name.
    Does anyone have a work around or will this be fixed at some point by Apple?

  • How to replace MobileMe with ICloud on my Imac?

    how to replace MobileMe with ICloud on my Imac? pleae help.  Other devices (Ipad and Iphone) are Iclouded but I can't change MobileMe in my system preferences on IMac (10.6.8)
    Sylwia

    You need to upgrade the computer's OS. Open the Mac App Store and try downloading Mavericks. If you get told it's incompatible, choose About this Mac from the Apple menu, check if the computer has at least a Xeon or Core 2 Duo(not Core Duo) CPU and 2GB of RAM, and if it does, click here and order a download code for Lion 10.7.
    Back up your data before upgrading. Mac OS X 10.7 and newer don't support PowerPC programs such as versions of Microsoft Office prior to 2008.
    (103507)

  • How to replace sapdba with brtools after upgrade database to 10.2

    All,
        I have update our database to oracle 10.2,my brtools version is 7.0 now ,
    but can't run analyze table and dbcheck in db13,
    seems to still use SQLDBA when run analyze table and dbcheck.
    please refer to the below informations.
    Detail log:                    0810080300.aly
    *****                 SAPDBA - SAP Database Administration for ORACLE     *****
    SAPDBA V6.10    Analyze tables
    SAPDBA release: 6.10
    Patch level   : 1
    Patch date    : 2001-05-25
    ORACLE_SID    : PRD
    ORACLE_HOME   : /oracle/PRD/102_64
    ORACLE VERSION: 10.2.0.2.0
    Database state: 'open'
    SAPPRD       : 46C
    SAPDBA DB USER:  (-u option)
    OS login user : prdadm
    OS eff.  user : prdadm
    SYSDBA   priv.: not checked
    SYSOPER  priv.: not checked
    Command line  : sapdba -u / -analyze DBSTATCO
    HOST NAME     : sapprd1
    OS SYSTEM     : HP-UX
    OS RELEASE    : B.11.31
    OS VERSION    : U
    MACHINE       : ia64
    Log file      : '/oracle/PRD/sapcheck/0810080300.aly'
    Log start date: '2008-10-08'
    Log start time: '03.00.09'
    ----- Start of deferred log ---
    SAPDBA: Can't find the executable for SQLDBA/SVRMGR. Please, install one of
            them or enter one of them in the SAPDBA profile (parameter
            sqldba_path).
            (2008-10-08 03.00.06)
    SAPDBA: Error - running temporary sql script
            '/oracle/PRD/sapreorg/dbacmd.sql' with contents:
    CONNECT /******** AS SYSDBA
    SAPDBA: Couldn't check SYSDBA privilege.
    SAPDBA: Can't find the executable for SQLDBA/SVRMGR. Please, install one of
            them or enter one of them in the SAPDBA profile (parameter
            sqldba_path).
            (2008-10-08 03.00.06)
    SAPDBA: Error - running temporary sql script
            '/oracle/PRD/sapreorg/dbacmd.sql' with contents:
    CONNECT /******** AS SYSOPER
    SAPDBA: Couldn't check SYSOPER privilege.
    ----- End of deferred log ---
    Analyze parameters:
    Object: All tables in table DBSTATC ( for DB optimization run )
    Method: E ( Default )
    Option: P10 ( Default )
    Time frame: 100 hours
    Refresh   : All objects
    Option: DBSTATCO ( for the DB optimizer: Tables with Flag DBSTATC-TOBDO = 'X' )
    ** Refresh Statistics according control table DBSTATC **
    Total Number of Tables in DBSTATC to be analyzed:                           170
    Number of Tables with forced statistics update (ACTIV = 'U'):                 0
    SAPDBA: SELECT USER# FROM SYS.USER$ WHERE NAME='SAPPRD'
    ORA-00942: table or view does not exist
               (2008-10-08 03.00.09)
    SAPDBA: Error - getting size of segment 'SAPPRD.D010INC'
    SAPDBA: Error - during table analysis - table name: ->D010INC
    SAPDBA: No tables analyzed ( No entries in DBSTATC with TOBDO = X or errors ).
    SAPDBA: 0 table(s) out of 170 was (were) analyzed
            Difference may be due to:
               - Statistics not allowed ( see DBSTATC in CCMS )
               - Tables do not exist on database and were skipped
    Detailed summary of Step 1:
    Number of Tables that needed new statistics according to DBSTATC:             1
    Number of Tables marked in DBSTATC, but non-existent on the Database:         0
    Number of Tables where the statistics flag was resetted:                      0
    ******* Creating statistics for all tables without optimizer statistics *******
    SAPDBA: Using control table DBSTATC
            for taking optimizer settings into account
    SAPDBA: 0 table(s) without statistics were found.
    SAPDBA: 0 table(s) ( out of 0 ) was (were) analyzed/refreshed.
            0 table(s) was (were) explicitely excluded or pool/cluster table(s).
    SAPDBA: 0 index(es) without statistics was (were) found.
    SAPDBA: 0 index(es) ( out of 0 ) was (were) analyzed/refreshed.
            0 index(es) was (were) explicitely excluded or pool/cluster indexe(s).
    SAPDBA: 157 table statistics from 157 tables were dropped.
            They are either explicitely excluded in DBSTATC,
            or R/3 Pool- or Cluster- tables
            that must not have CBO Statistics
    SAPDBA: The whole operation took 10 sec
    SAPDBA: Step 1 was finished unsuccessfully
    SAPDBA: Step 2 was finished successfully
    Date:   2008-10-08
    Time:   03.00.19
    *********************** End of SAPDBA statistics report ****************
    How to replace sapdba by brtools?please give me support,thanks.
    Best Regards,
    Mr.chen

    >     I have update our database to oracle 10.2,my brtools version is 7.0 now ,
    > but can't run analyze table and dbcheck in db13,
    > seems to still use SQLDBA when run analyze table and dbcheck.
    Yes, it does so, because somebody forgot to upgrade the BASIS SP as well...
    What BASIS SP are you using?
    regards
    Lars

  • Replace text with number

    Hi
    i have 2 columns from flat file
    0amount       number
    10000          
    "Intangibles"         2000
    20000              
    'sales'         4000
    my output is required like
    incase if i am getting text ( this text is not constant its coming like any thing shownw above example)  i need replace number key figure values in 0amount fileds.
    how can i reach with this in field routine
    data v_text type char
    if source_fields_0amount not equall number
    result 0 number ( kf)
    like what is code i need to use

    Hi,
    One thing's to be clarified :
    If you need sometimes number & sometimes text in a particular target field, then it has to be a char field and you cant do any mathematical operation on that later.
    --Akashdeep

  • How to replace numbers with text in tax return pdf using Adobe Acrobat X Pro

    How do I replace numbers with text in tax return pdf using Adobe Acrobat X Pro? The tax return was created using CCH software. Thanks for your review.

    Thanks Bill for your quick reply. CCH software is one of the major
    suppliers of tax return software. I found an internal source that helped me
    make the changes from numbers to text i.e. "$123,456" to "See Schedule O".
    I am not sure if I am working in form or final text. Thanks again! Kelly

  • Display of Name with Number of the calling person

    Hi all
    I have purchased a new NOKIA X2 as this is my first Nokia set I have noticed that when a person in my contacts list calls me the persons name only is displayed & not the number from which he is calling. As I have entered mobile number , work number & home number in the persons contact details. Plz. help

    @ jithin_009
    when u entre several nos for one name only the name is displayed when u recieve a call from either of the nos.
    if u wants to get the name with each no. entre the name with slight modification with the no as several entries.
    example.  jean office  - 011234567
                             jean Home - 011233333
    if u entre as above then u will get what u want.
    also remember if u entre same contact name with different nos, u will see only the specific no.   
    example   jean  - 011234567
                             jean  - 011233333
    now when u get a call from either no. u will see only the number, not the name
    check this and see the results
    cheers
    PS: if this information is helpfull please click the white star on green background

  • OSX renaming files names with number/letter suffixes

    I have some Quark files that are constantly being updated. Sometimes when I close and save the file, it renames it something like filename_f#CB70C.qxd (original name: filenameversionmonth, etc.), replacing my name with this gibberish! I have tried shortening the filenames and it still does this, but it's intermittent. I am working off of a server in an office, where a few people share the same files. I will rename it again and when I look in the window, it has snapped back to the gibberish name.
    Any ideas?
    Dual 1.8 GHz PowerPC G5   Mac OS X (10.3.9)   2 GB RAM

    jewelee:
    Welcome to Apple Discussions.
    I doubt whether OS X is doing this. Since it apparently happens with only one applicatication it may be a requirement of the application. (I don't know that; just a guess). I suggest that you try Repairing Disk Permissions, and see if it is a permissions issue.
    Good luck.
    cornelius
    PismoG4 550, 100GB 5400 Toshiba internal, 1 GB RAM; Pismo 500 OS (10.4.4) Mac OS X (10.3.9) Beige G3 OS 8.6

  • How To Replace LOVs With Buttons

    Hi all,
    can someone please advise if it is possible to replace LOVs with Buttons? Customer has a requirement to replace the LOVs with buttons in Compensation Manager to approve/reject the paysheet. This is for R12.1.3.
    Many thanks
    Amanda

    Hi,
    1) First create a new region of LOV type.
    2) Then under flowlayout region, add lov action button. On its 'External LOV' property, give the path of lov region created in step1.
    3) Right click on 'lov action button' to add 'lovActionMappings'.
    --Sushant                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to replace #MISSING with 0 in Hyperion Financial Report

    I am developing report in Hyperion Financial Reporting Studio. The report shows #MISSING for no data and does not look nice. I want to replace #MISSING with 0 (Like I did in SmartVIEW). However, I could not find a way to do that in Financial Reporting Studio.
    Thank you for any help in advance.

    To replace no data (#MISSING) in cells, type a value in the No Data text box.
    Refer: Page 191 of http://download.oracle.com/docs/cd/E12825_01/epm.111/fr_user.pdf
    HTH-
    Jasmine.

  • My ipad has been burnout today while charging it...Today it has been totally burnt and its screen got cracked from middle and charger got so tempered as hot burning rod. kindly suggest how to replace it with new as my ipad is in warranty period..? Rajiv.

    How to replace my burnt ipad while charging it ?????
    plz. HELP ????
    its warranty is till august 18, 2014.

    This is a user-to-user forum here.  You need to talk to Apple Support directly.
    http://www.apple.com/support/contact/

  • How to replace name in LR?

    Maybe I just missed it. My files look something like DSC_1234.nef. I want to just replace the "dsc" and not the whole name. I did not see where I can just replace part of the filename in LR. Any ideas? What we are trying to do is replace the dsc with the real name along with adding a serial number. It would ultimately look like name.1234-001.nef. I backup my raw images right away to dvd then edit them in LR. Once done they are exported to jpgs. The 1234 will represent the raw file # and 001 is obviously the serial number for the client. Any ideas? Thanks, Chad

    This is simple. In the rename dialogue, you will need to click the 'File Naming' drop down. Click edit.
    In the template editor, make sure all the text in the big white box is selected. Press delete.
    Now, under image name, click the second drop down and select Original number suffix. Click to the right of the name convention in the big white box so that the cursor is at the end.
    Now click on the Sequence drop down and select Sequence # (001).
    You will now have a file naming convention that matches perfectly to what you asked for.
    It will take DSC_1595.NEF and make it:1595-001.NEF
    This is a bit weird to me since the original file name is in running order anyways. The only thing that I can imagine is that you have a customer number that you want to attach to the end of the Original number suffix. Of course that wouldn't change from image to image. If that's the case, instead of making Sequence # (001) the second step, change it to Custom Text. Then you will be prompted for the customer number upon rename and it would change DSC_1595.NEF and make it 1595-Customer#.NEF
    Hope this helps.

  • How to replace IMessage with Ichat

    I have recently updates to os x mountain Lion, and Ichat has been replaced. I hate IMessage how do i get back Ichat.

    HI,
    The iChat App is specific to each Update within an OS X version run.
    Messages is the version on Mountain Lion.
    At OS X 10.8.2 it became version 7.0.1
    That is to say that version 7.0 lasted for OS X 10.8 and 10.8.1
    You can get Messages to look somewhat iChat like.
    Lets say you have AIM (or AIM valid) Names and some Jabber IDs (including GoogleTalk or Facebook)
    Either Add them in Messages the same way you would have in iChat (Use the Plus icon in Preferences > Accounts) or by activating the choice for Messages in System Preferences > Mail, Contacts and Calendars for any ID/Name you use in Mail or elsewhere.
    This will give you a list of Accounts in the Messages Menu > Preferences > Accounts including the iMessages one and the Bonjour one.
    If all are Enabled then the Window menu will now show Buddies (CMD + 1) in addition to the Messages (CMD +0)
    If you use this you will see a combined Buddy List.
    The can be unlinked by going to Messages > Preferences > General Section and Unticking the line that talks about "gather all accounts in to one list"  (actually it is only Buddy lists Account and does not include the iMessages account)
    The Window Menu will now list as many Buddy lists as you have Accounts (Less the iMessage one and any that are not logged in.)
    Each will have it's own keystrokes listed.
    The title of the Buddy list and the Name in the Window Menu is dependant on the Description Field in the accounts pane.
    Example Pic of the Accounts Prefs pane with Buddy lists
    The iMessages account does not have to be active.
    The main draw back is the Messages window itself with it's dual purpose Tabbed Chat window and interface to start Chats without using the Buddy lists.
    Double clicking a chat will open it in it's own window.
    9:39 PM      Thursday; January 24, 2013
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How to Replace Footage with an AVCHD .MTS?

    I have a sequence edited together from what I thought was a master H264 M4V.  I now find out that the real master is AVCHD. So how can I replace my M4V footage with an MTS?
    If I do a Replace Footage, I can see multiple AVCHD MTS Streams and the usual mess of folders inside a BDMV folder, but I seem to only be able to import via Media Browser. Replace Footage doesn't work with files already in Premiere, right?
    I've only worked with AVCHD files once before, so I'm a little lost.

    Jim,  I'm sure we've had this discussion before..... but it's not the fault of either the camera makers OR Mac users    Since I'm now using both Mac and Windows 7 equally, I really have no axe to grind against either company.
    This is entriely the fault of Microsoft who were unwilling to license NTFS to other companies, including Apple, Linux etc, added to the fact that NTFS is not suitable for lower powered devices with small amounts of embedded RAM.  NTFS is simply too complicated for them to handle using small microcontrollers, so hoping for NTFS on cameras is folly in my mind.  It's just not going to happen.
    Apple, like Linux also have a file system that can handle larger files, larger even than NTFS.  The Linux file system is also open source and royalty free, so could be used free of charge by lots of camera manufacurors if they wanted to (excpet it's also a lot more complicated than FAT32), but Microsoft choose not to support it (i.e. you couldn't read the cards on Windows), probably to try block Linux getting an even stronger hold on their server market than it has already.
    The fact is that FAT32 was simple to implement for small memory devices of years gone by and nothing has come along to replace it that was (a) easy on the CPU / RAM and (b) royalty free.
    There's no reason they couldn't implement a FAT64, FAT128 etc, though Microsoft would probably be the sticking point there too.....
    UDF was supposed to be a new replacement that could be universal (hence the name Universal Disk Format), and indeed it's easy to use in read only format (UDF 1.2 is used by even the lowest powered DVD player from 15 years ago!) but to write to UDF takes a lot more power and memory.  Also, the UDF format has evolved and is now even more complicated than before.  So, UDF is not an option either.
    So, yes, the 2GB limited is caused by a 2s compliment implementation of a 32 bit file system (tecnically it could do almost 4GB, allowing for FAT terminators etc, but they only use 31 bits for the file size, which allows for reverse seeking), in a FAT (File Allocation Table) format.
    Finding the next lowest common denominator is the task I hope they pull off soon.  While we can all usually work around the 2GB limit (by joining files) it would be much easier to have complete files in the first place

  • Replacing Name with the Respective Code

    Hi,
    I have one table called CodeName, which contains Code and Names of Products.
    Eg: 1 Table
    2 Chair
    3 Car
    I have another table called NamePrice, which contains Name of the products and their Price.
    Eg: Table 495
    Chair 250
    Car 200000
    My Requirement is to replace the Codes, instead of Names in NamePrice table, which should be compared from CodeName table.
    Eg: 1 495
    2 250
    3 200000
    I am new to SQL. I just want to know, can we use for loops or while loops to solve the above problem.
    If not, how can we do ?
    Please give me some links of SQL to learn it in online.
    Regards
    VaradhRAJAN

    This?
    with
    code_name as
       (select 1 num, 'table' nm from dual union all
        select 2, 'chair' from dual union all
    select 3, 'car' from dual),
    name_price as
       (select 'table' nm, 495 pr from dual union all
    select 'chair', 250 from dual union all
    select 'car', 200000 from dual)
    select cn.num, np.pr
    from code_name cn, name_price np
    where cn.nm = np.nm
           NUM         PR
             1        495
             2        250
             3     200000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Upgrade 10gR2 to 11gR2 with apps 11.5.10.2  - Please help with rpm package

    Hi OS : Oracle Enterprise Linx 4 update 5 DB: 10.2.0.4 Apps: 11.5.10.2 I am upgrading my current 10.2.0.4 db with 11.5.10.2 apps TO 11.2.0 db and apps 11.5.10.2 When I am installing 11g software only. I am getting the following error Package: ocfs2-t

  • IExpenses Approval Workflow

    Hi All, We have a requirement to customize the Expenses Approval workflow (AP Standard Expense Report Process Workflow) to send additional notifications. Once the seeded workflow is customized by adding a custom process, I am unable to figure out how

  • FORMS6 - XML/DTD Sample Code???

    Dear Sirs: we are still developing FORMS 6 application. We would like to generate XML documents according to the definition contained in DTD files - a technology we still don't know. Do You know whether sample PL/SQL code dealing with XML and DTDs is

  • Sales order Customer Requested Delivery Date

    Hi Experts We are getting date difference of Customer Requested Delivery Date in MD04 and Product View for one customer. Scenario: Created Sales order by giving CRD date as 26.07.2010 and In APO Product View the same sales order shows 25.07.2010. Ple

  • Mail gone psycho

    Hi My mail program has gone nuts on me. Occasionally I quit mail and it restarts by itself over and over and over. Often it prevents me from shutting down so I have to force quit it. But for the last three days I have been receiving about 200 spams t