Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> conditional In-List

conditional In-List

From: Oxnard <oxnard_at_carolina.rr.com>
Date: Sat, 21 Apr 2007 12:26:52 -0400
Message-ID: <462a3b5e$0$5775$4c368faf@roadrunner.com>


I am trying to do a 'conditional In-List'. Here is what I mean.

insert into bdt
select 'a' as c1,'b' as c2,'c' as c3,'d' as c4 from dual union all
select 'aa' as c1,'bb' as c2,'cc' as c3,'dd' as c4 from dual union all
select 'a1' as c1,'b' as c2,'c' as c3,'d' as c4 from dual union all
select 'a2' as c1,'bb' as c2,'cc' as c3,'dd' as c4 from dual union all
select 'a3' as c1,'b1' as c2,'c1' as c3,'d1' as c4 from dual union all
select 'a4' as c1,'b1' as c2,'c1' as c3,'d1' as c4 from dual union all
select 'a5' as c1,'b2' as c2,'c2' as c3,'d2' as c4 from dual union all
select 'a6' as c1,'bb' as c2,'cc' as c3,'dd' as c4 from dual union all
select 'a7' as c1,'b3' as c2,'c3' as c3,'d3' as c4 from dual;

insert into lkup_c2
select 'e','e','bb' from dual
union all
select 'e','e','b1' from dual
union all
select 'e','e','b' from dual
union all
select 'f','e','x1' from dual
union all
select 'f','e','x' from dual;

insert into lkup_c3
select 'e','e','cc' from dual
union all
select 'e','e','c1' from dual
union all
select 'e','e','c' from dual
union all
select 'f','e','x1' from dual
union all
select 'f','e','x' from dual;

In short if either of the in lists returns no rows it should be ignored. I am really stuck on how to do this. The best idea I have come up with is to dynamiclly building the query as a string. I would first check if the lookup tables return a value then put it in the string. Then use an OPEN-FOR statement with
a cursor variable. The values of column la in both tables is provided at run time by the calling application.

Thanks Received on Sat Apr 21 2007 - 11:26:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US