hi
 
well, one way to do it is to create a stored function
 
create or replace package pkg_select
is
function cmb(p1 varchar2, p2 varchar2)
return varchar2;
end;
 
create or replace package body pkg_select
is
function cmb(p1 varchar2, p2 varchar2)
return varchar2
is
begin
  if p1 = 'A' and instr(p2, 'A|B|C|D|E') >0 then
    return 'TRUE';
  elsif p1 = 'B' and instr(p2, 'A|B|C|D|E|F|G|H|etc...') >0 then
    return 'TRUE';
  else
    return 'FALSE';
  end if;
exception
  when others then
    return SQLERRM;
end cmb;
end pkg_select;
 
then do
 
select col1, col2 from table1 where pkg_select.cmb(col1, col2) = 'TRUE';
 
This keeps your select nice and simple, also you can create a function-based index to give fast performance.
 
Rgds
Greg
 
-----Original Message-----
From: Saurabh Sharma [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 31 May 2001 09:50
To: Multiple recipients of list ORACLE-L
Subject: querry..

hi list,
 
how can i select two columns from a table based on condition that they are selected in specified combinations.
 
let me..
table 1 has 2 columns col1, col2. both cols have values , say, alphabets. a,b,c,d,e,f,...
i'want to select like
 
FOR VALUE OF COL1 IN A,  col2 must fetch only between A-E
for value of col1 in B, col2 must be between A-X
--
 and so on..
 
i want to define this combination, so i should get only these pair of values.
 
any suggestions.
thanks.
 
saurabh

Reply via email to