Hi All,
I've got a cursor that looks a bit like this...
cursor my_cursor (in_other_value varchar2);
select *
from a, b
where a.foriegn_key = b.primary_key (+)
and nvl(b.other_value(+),'^^' = nvl(nvl(in_other_value,b.other_value),'^^)
I thought this would work but it doesn't, My problem is that I must outer join to b as many of the records from a do not have a corresponding record on b, if no value is passed in in in_other_value then it should not restirct on it. So I thought compare the value from the outer join to the value passed in, but if they are both null then it will get rejected to nvl them again to an arbitry string (^^) so that they will match. This isn't working though. If I supply a value in in_other_value then all rows get returned, not just those that match the value passed in.
HELP!!
Mike.
I've got a cursor that looks a bit like this...
cursor my_cursor (in_other_value varchar2);
select *
from a, b
where a.foriegn_key = b.primary_key (+)
and nvl(b.other_value(+),'^^' = nvl(nvl(in_other_value,b.other_value),'^^)
I thought this would work but it doesn't, My problem is that I must outer join to b as many of the records from a do not have a corresponding record on b, if no value is passed in in in_other_value then it should not restirct on it. So I thought compare the value from the outer join to the value passed in, but if they are both null then it will get rejected to nvl them again to an arbitry string (^^) so that they will match. This isn't working though. If I supply a value in in_other_value then all rows get returned, not just those that match the value passed in.
HELP!!
Mike.