Trying to accomplish a table lookup so that each row of t1 is
"assigned"
exactly one segment in t2 based on the where statement given, thereby
grouping records in t1 together based on segment. (The number of input
records = number of output records)
each row of t1 now contains
grp
grr1
grr2
grr3
grr4
segment
And then that info is then used downstream.
I'm exploring other ways since using the straight SQL takes over 5
days.
Generally, if one was to code up identical techniques in both SQL and
PL/SQL, which one would
be faster? Or does it depend on the code itself?
Another way to do this is to perhaps have a subquery with the equality
in the predicate
where t1.grp = t2.grp
while at the same time have the inequality in a CASE statement to set
a flag
CASE
WHEN
(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)
THEN 1
ELSE 0
END flag
and then outside the subquery simply take the records where FLAG = 1
but I was thinking it would maybe blow up the Oracle temp space
since the subquery would be fanning out alot.
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
-~----------~----~----~----~------~----~------~--~---