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!

Getting unique records from table

Milind JadhavAug 24 2012 — edited Aug 28 2012
Oracle Database Version is 10g ( 10.2.0.4.0)

I have two table emp_perm & employee.
1) Table emp_perm is a lookup table with 2 columns, temp VARCHAR2 & perm VARCHAR2.
Table emp_perm have below data in it:-
temp              perm
1064885        0349034
0099982       7399982
6476456        9170346
5252525       5252525
2) Now table employee might have following combinations of rows.

Records for both Temps file (1064885) and perm file number (0349034) does exist in employee table, in this case Delete Temp File Number records i.e. 1064885 and keep Permanent File Number (0349034) records as it is.

Records for only temp file number(0099982) does exists and corresponding perm file(7399982) does not exists in employee table in this case convert these records i.e. update 0099982 with its perm file number 7399982 using lookup table emp_perm.

Records for only perm file number exists (9170346) and corresponding temp file number (6476456) does not then do not amend employee table, as we are interested in perm file numbers.

If file number does exist in lookup table in emp_perm and both of them are equal (5252525) then do not amend employee table as temp and per file number are same.

Could you please help me to achieve this?

Any link to solution in the forum is also great.

(Used this link http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004
to avoid duplicates but not able to get to end of it)

Edited by: Milind Jadhav on Aug 24, 2012 4:41 AM

Edited by: Milind Jadhav on Aug 24, 2012 4:44 AM

Edited by: Milind Jadhav on Aug 24, 2012 4:45 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 25 2012
Added on Aug 24 2012
5 comments
349 views