Home » SQL & PL/SQL » SQL & PL/SQL » doubt on simple select
doubt on simple select [message #258123] Fri, 10 August 2007 05:53 Go to next message
soujanya_srk
Messages: 111
Registered: November 2006
Location: HYDERABAD
Senior Member
i have a very simple doubt...but its an important one..

i have a function, where i am using a cursor to retrieve data,

what i am providing here is a sample table and select, but
the actual select is in the cursor...and i am only providing
a part of select..its actually a cusor with parameter


create table ECOF(funid number,active number(2));

insert into ecof values(211,1);
insert into ecof values(212,1);
insert into ecof values(213,1);
insert into ecof values(214,1);
insert into ecof values(215,1);
insert into ecof values(216,1);
insert into ecof values(217,1);
insert into ecof values(218,1);
insert into ecof values(219,1);
insert into ecof values(220,1);
insert into ecof values(310,1);
insert into ecof values(311,1);
insert into ecof values(312,1);



i want only those rows between 212 and 220, and also
311, 312..

now i can use this


select funid from ECOF
where funid in (212,213,214,215,216,217,218,219,220,311,312)
/


but i think this may make my cursor look ugly..is there any
other way to get only those rows?

Re: doubt on simple select [message #258135 is a reply to message #258123] Fri, 10 August 2007 06:30 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
What's wrong with an OR?
select funid from ECOF
where ((funid between 212 and 220) or funid in (311,312))
Previous Topic: How to get the 7years back date based on the sysdate???
Next Topic: v$tempseg_usage
Goto Forum:
  


Current Time: Tue Dec 03 21:11:54 CST 2024