update of table with similar registration information using the same key

Version: 11.1.0.7.0

We have large table probably 30 M records

-test code table follows

create table people)

person_id number,

first name varchar2 (50).

middle_name varchar2 (50).

last_name varchar2 (50)

);

insert into persons (person_id, first_name, last_name, middle_name) values (1, 'JOHN', 'A', 'DOE');

insert into people (person_id, first_name, last_name, middle_name) values (1, 'JOHN', ","DOE");

insert into persons (person_id, first_name, last_name, middle_name) values (1, 'JOHN', 'ADAM', 'DOE');

insert into persons (person_id, first_name, last_name, middle_name) values (2, 'JOHN', ' C ', 'DOE');

insert into people (person_id, first_name, last_name, middle_name) values (2, 'JOHN', ","DOE");

insert into people (person_id, first_name, last_name, middle_name) values (3, 'JOHN', ","MOE");

insert into persons (person_id, first_name, last_name, middle_name) values (3, 'JOHN', 'FRANK', 'MOE');

I am trying to write more efficient code to take the middle name of the most complete and updated all records with the same KEY (person_id) with her.

Expected result:

1, JOHN, ADAM, DOE

1, JOHN, ADAM, DOE

1, JOHN, ADAM, DOE

2, JOHN, C., DOE

2, JOHN, C., DOE

3, JOHN, FRANK, MOE

3, JOHN, FRANK, MOE

Hello

Here is an example of the use of the aggregate LAST instead of the function ROW_NUMBER analytic function:

MERGE INTO dst people

WITH THE HELP OF)

WITH got_longest_middle_name AS

(

SELECT person_id

, MIN (middle_name) DUNGEON (DENSE_RANK LAST ORDER OF LENGTH (REPLACE (middle_name, '.')))

AS longest_middle_name

AMONG the people

WHERE middle_name IS NOT NULL

GROUP BY person_id

)

SELECT person_id

longest_middle_name

Got_longest_middle_name c - c is for candidates

WHERE DOES NOT EXIST)

SELECT 1

AMONG the people

WHERE person_id = c.person_id

AND c.longest_middle_name NOT AS REPLACE (middle_name, '.'). '%'

)

)             src

WE (dst.person_id = src.person_id)

WHEN MATCHED THEN UPDATE

SET dst.middle_name = src.longest_middle_name

WHERE dst.middle_name <> src.longest_middle_name

OR dst.middle_name IS NULL

;

I suspect that this may be a little faster, but try it on your system with your data to make sure.

Tags: Database

Similar Questions

  • Update a table with a query that uses the table updated

    Hi This is my request. It's a mistake, but I hope that the basic idea may carry out. Cost_before_Decision is a column by using an alter table statement, I added:
    UPDATE fraud_nov_14_final
    SET Cost_before_Decision = (select Cost_Prior 
                                from    fraud_nov_14_final ff
                                      ,(select cla_case_no, sum(case when decline = 1 or decline = 2  
                                                                  THEN (nvl(total_cost_adj_old,0) + nvl(decline_estimate,0)) 
                                                                  ELSE Total_Cost 
                                                                  END) Cost_Prior
                                        from reporting.ci_final@test
                                            group by cla_case_no) z
                                                    where ff.cla_case_no = z.cla_case_no)
    Error I get is:
    Error report:
    SQL error: ORA-01427: einreihig subquery returns multiple rows
    01427 00000 - "einreihig subquery returns several lines.

    Thanks in advance for your help:

    Banner:
    Oracle Database 11 g Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE 11.2.0.2.0 Production."
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    Try this

    update fraud_nov_14_final a
       set cost_before_decision = (
                        select cost_prior
                          from (
                             select cla_case_no, sum(case when decline = 1 or decline = 2  then (nvl(total_cost_adj_old,0) + nvl(decline_estimate,0)) else total_cost end) cost_prior
                               from reporting.ci_final@test
                             group by cla_case_no
                               ) b
                                   where a.cls_case_no = b.cls_case_no
                         )
    
  • my wireless connection says "restricted access" no network connection. I used the same key code to get my other computer online

    my wireless connection says "restricted access" no network connection, I used the same key code to get my other computer I can have up to 5 computers online at the same time online.

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Hello

    This means that the computer cannot connect to the router.

    Try this process.

    Check the Device Manager for the wireless card valid entry.

    http://www.ezlan.NET/Win7/net_dm.jpg

    If there is no valid entry, remove any entry from fake and re - install the drivers for the wireless card.

    Check network connections to make sure that you have a network icon/entry wireless connection, and that the properties of the icon (right-click on the icon) are correctly configured with the TCP/IPv4 protocol in the properties of network connections.

    http://www.ezlan.NET/Win7/net_connection_tcp.jpg

    Make sure that if there is Wireless Utility a utility vendor is not running with the native Windows wireless utility.

    Make sure you firewall No. preventing / blocks wireless components to join the network.

    Stack TCP/IP work should look like.

    Right-click on the wireless network connection card, select status, details and see if she got an IP address and the rest of the settings.

    http://www.ezlan.NET/Win7/status-NIC.jpg

    Description is the data of the card making.

    The physical address is MAC of the card number.

    The xx must be a number between 0 and 255 (all xx even number).

    YY should be between 0 and 255

    ZZ should be between 0 and 255 (zz all the same number.)

    The date of the lease must be valid at the present time.

    * Note 1. IP that starts with 169.xxx.xxx.xxx isn't valid functional IP.

    * Note 2. There could be an IPv6 entries too. However, they are not functional for Internet or LAN traffic. They are necessary for Win 7 homegroup special configuration.

    ---------------------------------------------------

    Above everything is OK, you must be able to connect to the router.  A window that says connected does not mean that you are really connected. Connection to the router means that you can enter the IP of the router base in an address bar in one go, being able to connect and configure the router menus see. If it is not connected in the log to router from any computer that can connect to the router wirelessly with a wire, disable wireless security, (make sure that the wireless SSID broadcast) is on and try to connect with no. wireless security.

    --------------------------------------------------

    I really checked and configured every thing and it doesn't work.

    Software firewall application that is not configured to allow local traffic (between the computer and the router is also a possible problem.
    some 3rd party software firewall continue to block the same aspects it traffic Local, they are turned Off (disabled). If possible, configure the firewall correctly or completely uninstall to allow a clean flow of local network traffic. If the 3rd party software is uninstalled, or disables, make sure Windows native firewall is active .

    Jack-MVP Windows Networking. WWW.EZLAN.NET

  • Can I use the same key signature for the WebWorks bar and bar of the Android app?

    I have applied the signature key for my WebWorks Playbook applications, works without problem.

    Am I able to use the same key to sign transformed Android apps?  Tried several times and always got error: invalid password, while the same key/password works fine with Webworks bar signature. Don't know if I did something wrong or I have to apply a new key for the signature of the Android app.

    Thank you

    Yes.  This is discussed here: http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/What-happens-when-the-signing-cer...

  • How to put windows 7 pro on the new computer using the same key on the side of the other computer

    I have a computer comes with windows 7 pro. I am now building a new computer. How to put windows 7 pro on the new computer using the same key on the side of the computer. I don't have a Windows 7 disc.

    Original title: Windows 7 pro

    Tuesday, October 14, 2014 20:31:20 + 0000, 4hammond wrote:

    I have a computer comes with windows 7 pro. I am now building a new computer. How to put windows 7 pro on the new computer using the same key on the side of the computer. I don't have a Windows 7 disc.

    You can not, for at least one (and two possible) reasons.

    1. it isn't clean if you want to have two computers, or you
    you want to remove from the old computer and put it on the new. If
    you want once, you can't do that - the rule is very clear: there
    a copy (or a license) for each computer.

    There is nothing new here. This is exactly the same rule that has been in
    effect on all versions of Windows from at least with Windows 3.1.

    2. but even if you want it on a single and from uninstall
    the old computer, you can't do it. It is because if it came with the
    computer, it is an OEM version and the biggest drawback to he a
    OEM version, is that its license it permanently binds to the first
    It is installed on the computer. He can never legally be moved to another
    computer, sold or assigned (except with the original computer).

  • Can I change my Pro of Win7 32-bit to 64-bit by using the same key from the Dell OEM disc?

    I have a new laptop with Win7 32 on it, but I really wanted 64 bit - I missed that detail. I've read elsewhere that the 32-bit key is the same for 64.

    So, can I download Win7 64 Pro (same version, only 64-bit) and install it on the laptop using the Win7 32 bit key on the OEM disc?

    Thank you.

    Yes, it will work fine - the key for the same version of Windows works, whether at the level of the ILO.  You can download a retail ISO, burn to DVD, move in with him, then activate by phone (with Microsoft NOT Dell) using the product key on your COA sticker.

    www.mydigitallife.info/Download-Windows-7-ISO-Official-32-bit-and-64-bit-Direct-Download-Links

  • can I move my wnds 7 to another computer and use the same key

    can I move my wnds 7 to another computer and use the same key

    If the copy of Windows 7 comes with your computer, none.  Otherwise, Yes.

  • If I uninstall Windows 7 and then reinstall it on the same computer, using the same key/copy register?

    Need a quick answer here! I'm selling my older HP laptop that has Windows 7 above. I intend to uninstall the operating system, and then reinstall it to wipe all my data. The copy is just a simple upgrade from Home Premium (the laptop came with Vista). When I reinstall, can I still register by using the same key? I have heard that it is installed on a computer at any time then you can, but I'm not completely sure.

    Enable is the right term, Yes. Now what happens if I simply select "Custom" when I try to install the upgrade of Windows 7 since I don't have a Vista disk?

    If your Windows 7 is an upgrade license any system move to must have a previous operating system eligible before you can use it elsewhere. You may also need to reactivate by phone:

    How to activate Windows 7 manually (activate by phone)
     
    1) click Start and in the search for box type: slui.exe 4
     
    (2) press the ENTER"" key.
     
    (3) select your "country" in the list.
     
    (4) choose the option "activate phone".
     
    (5) stay on the phone (do not select/press all options) and wait for a person to help you with the activation.
     
    (6) explain your problem clearly to the support person.
     
    http://support.Microsoft.com/kb/950929/en-us

  • Reinstalling Windows Vista tells me to activate windows, but don't let me use the same key

    I had to erase and reinstall and now it tells me to activate windows, but don't let me use the same key... I don't want to buy a new key, I always use the same program Windows Vista... HELP Please!

    Original title: the windows product key

    Hello

    How do you re-install?

    Do you have or use a sale at retail or OEM DVD?

    Do you have an error message: "key already in use"?

    If you re-installed the same operating system on the same computer and you receive an error message, you will normally need to make a phone Activation > ignore the automatic prompt > and brace yourself for a real person explain.

    "How to activate Vista normally and by Activation of the phone '

    http://www.Vistax64.com/tutorials/84488-activate-Vista-phone.html

  • using the same key on another computer

    I thought that I can use the same key to windows vista to computers at least 3 is this correct?

    N °

    This is false.

    A Vista license/product key = a Vista Installation on a computer.

    See you soon.

    Mick Murphy - Microsoft partner

  • Win7 with FF 31, smart phone 4.2 with FF letest ver. using the same account with 1 email. But the phone is not getting any collar, Bokmr, etc.

    Brother.
    We use win7 with Mozila 31, 4.2 with Mozila Android smart phone latest google app store on 04/10/0214. Using the same account with the same email. But the phone does not get any new information of win7 with Mozila 31. PL z give useful information.

    Hi w3ur_team,
    Thank you for your question. I understand that there are two features that are documented in the sync account. However the Android is not synchronized.

    There are two places we can check:

    1. In the Android settings, under accounts is the Firefox Sync or Firefox Sync (discouraged) joint account?
    2. Credentials work on accounts.firefox.com on the mobile device and are there any error messages in the synchronization of the settings menu > sync?

    See also Firefox Sync troubleshooting and tips for more troubleshooting steps.

  • Extracting data from table without refreshment and without using the tab key.

    Hi friends,

    I have a problem I want to extract data from table without discount in the text field without using the Tab key. When I enter a field value any value then the text corressponding should enter into corressponding textfield without using the Tab key.

    for example. When I get back emp_id 101 in a text field then first_name and last_name, address would come in to the text fields corressponding without refresh and use the Tab key.

    How can I do that.

    Thank you
    Maury

    Hi Maury,

    I guess it's similar to: retrieving data without refreshing rather than Re: value of a textfield should enter into an another textfield without using the TAB ?

    If so, the only change you want to bring on the first is to use the parameter "Onkeyup" instead of "onchange" in the 'HTML Form attributes of the element' element.

    Note, however, that the user must move away from the issue at some point (for example, to click on a button), so the onchange will fire anyway.

    Andy

  • Tecra R850 with Windows WXP - cannot use the FN key

    Hello

    On a Tecra R850, I can't use the FN key. I installed all the drivers for toshiba and they does'nt work

    Help

    Thank you

    Hello

    All this is a bit complicated with WXP and it is important to install everything in the right installation order. After some base such as chipset, display and sound drivers you need to install the common modules at the beginning and continue with Toshiba-specific tools and utilities like controls, screen, energy saving and so on.

    You can use a combination of FN keys or none of them does not work?

  • my pc is Windows xp. but I up grade to windows7 and I want to register with microsoft. can I use the same disc if I reboot my pc?

    help me with this plese...

    It is not clear what you're asking. Next time please put your question - with enough detail to be clear - in the body of the message, not on the subject line.

    I interpret your message to mean:

    1. you have a computer with Windows XP.
    2. you're going to buy a Windows 7 upgrade, using the Windows XP install like materials for upgrading qualification.
    3. you want to know if you can use the Windows XP license on another computer.

    If I interpreted your message correctly, the answer is 'no '. The Windows XP license is subsumed under the license of Windows 7 when you use it for an upgrade.

    If this wasn't what you meant, please clarify. MS - MVP - Elephant Boy computers - don't panic!

  • If I replace my motherboard I have to buy Windows again or if I can use the same key?

    A motherboard / licensed

    The motherboard in my computer is dead (well not exactly, the USB ports short anything plugged). I RAM would be the Council because it is still under warranty, but the manufacturer says that the problems are not covered by the warranty. I'm in a situation where I need to replace my motherboard. I also found that my motherboard is no longer manufactured. I'll be able to buy a new motherboard and reinstall Windows? I was told that since a computer cannot exist without a motherboard I'll have to buy another copy of Windows: new motherboard = new computer = new copy of Windows. But I was also told that if I have a retail copy, what I do, and not an OEM, I was able to reinstall my copy if I replace my motherboard. How true this is?

    All this is true!

    If you have a retail version, you can change the card mother as many times as you like as long as your license is used only on any given computer one at a time.

    After the fifth installation of your license, phone activation may be required.

    Only OEM versions are related to the first motherboard forever, unless the manufacturer can sell you a model which replaced the abandoned.

Maybe you are looking for

  • I'm trying to download contact via iCloud but this isn't the case

    Hi all I'm trying to download the contacts to my pc via icloud. but nothing happens. After you have selected all the contacts, when I type "Export vCard" option nothing happens. My configrations system are OS: Window 10 Browser: Chrome/Edge/IE

  • iTunes Airplay on Macbook Pro

    iTunes will automatically mute volume when it connects first to my device Airplay (Cambridge Audio CXN, network drive). Is there a way to avoid this?

  • the sign "more" to open a new tab disappeared. That's happened?

    the sign "more" to open a new tab disappeared. That's happened? How can this be repaired?

  • Try to reinstall Snow Leopard, no disc to install to

    My computer crashed and when I rebooted I got an error which means not only no BONES. I try to use a Snow Leopard disc to reinstall Mac OS X, but when I get to the point where it asks me to "Select the drive where you want to install Mac OS X", nothi

  • Direction of airflow cooling Pavilion?

    Can someone please tell me the meaning of air circulation on a Pavilion zd7000 series laptop?  Mine is dismantled (awaiting another motherboard) and I try to order a block of engine cooling. Is the air is taken from the bottom and evacuated by the si