troubleshooting Question

Oracle query help

Avatar of toooki
toooki asked on
Oracle DatabaseDatabases
17 Comments2 Solutions467 ViewsLast Modified:
If you could please help with this Oracle (11gR2) query..

I have two tables T1: (about 1000 records)
F1 varchar2
F2 number
F3 number
F4 number
F5 date

And T2: (about 600 records)
F1 varchar2
F2 number
F3 number
F4 number
F5 date

All records in T2 is in T1.

I need to update T1 table's F5 field with the value of T1 table's F5 value when there is a match of T1.F1=T2.F1, T1.F2=T2.F2, T1.F3=T2.F3, T1.F4=T2.F4.

So the Output will return 1000 records (all T1 entries and possibly 600 rows updated with F5 values.)

Now problem is I call it a match if F1 is null in both tables and rest F2, F3, F4 values match.

If I write select T1.F1, T1.F2, T1.F3, T1.F4, T2.F5
from T1, T2
where T1.F1=T2.F1
and T1.F2=T2.F2
and T1.F3=T2.F3
and T1.F4=T2.F4

I do not get the correct output..
ASKER CERTIFIED SOLUTION
Pratima

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 17 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros