Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

find duplicate records and insert counter value

AnneeApr 27 2017 — edited Apr 28 2017

Oracle version 11g

Table:
-------
firstName   lastName    Counter
------------------------------------------
John           Ray          
John           Ray          
John           Ray      

   

Peter         Paxton       
Peter         Paxton   
Peter         Paxton        
Peter         Paxton        
Peter         Paxton        

Need an Oracle stored proc to get all the records with duplicate FirstName+LastName combination
and insert an incremental counter value so that the output looks like below.  Appreciate any help. Thanks. 

firstName   lastName    Counter
-------------------------------------------
John          Ray                 1
John          Ray                 2
John          Ray                 3

Peter         Paxton            1
Peter         Paxton            2
Peter         Paxton            3
Peter         Paxton            4
Peter         Paxton            5

This post has been answered by Frank Kulash on Apr 27 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 26 2017
Added on Apr 27 2017
10 comments
733 views