Oracle table t1 contains grp and 4 scores.

grp
grr1
grr2
grr3
grr4

Number of recs in t1 is 3 billion.

Oracle table t2 contains grp and MIN and MAX vales for each of the 4
scores and also segment.

grp
grr1_min_sc
grr1_max_sc
grr2_min_sc
grr2_max_sc
grr3_min_sc
grr3_max_sc
grr4_min_sc
grr4_max_sc
segment

Number of recs in t2 is 200K

In Oracle, I am performing a table lookup of segment using the
following
statement. Segment is unique on t2.

select t2.segment
from t1, t2
where  t1.grp = t2.grp and
       (t1.grr1 >= t2.grr1_min_sc and
        t1.grr1 < t2.grr1_max_sc) and
        (t1.grr2 >= t2.grr2_min_sc and
        t1.grr2 < t2.grr2_max_sc) and
        (t1.grr3 >= t2.grr3_min_sc and
        t1.grr3 < t2.grr3_max_sc) and
        (t1.grr4 >= t2.grr4_min_sc and
        t1.grr4 < t2.grr4_max_sc)

The lookup table (t2) is set up such that each row of t1 will lookup
exactly one segment in t2.

How can I write the above code in PL/SQL?
Since each row of t1 will match with only one row of t2, once there is
a match
I guess I would want to goto next record. How can I code that up in PL/
SQL?

Thanks

Tom


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to