Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Determining if parameter is within range of values
"Scott Hamlin" <HamlinS_at_smu.edu> wrote in message news:<atcv2t$11qvt5$1_at_ID-147295.news.dfncis.de>...
> I have an interesting problem. I need to determine if a parameter passed to
> a stored procedure exists between (or equals) two fields in a table. Here is
> an example. If I have two fields called Number1 and Number2, and for a
> particular row, Number1 equals 10 and Number2 equals 14, I need to know if
> the parameter equals 10,11,12,13, or 14. Effectively, all the numbers
> between Number1 and Number2 are reserved. Any ideas?
>
> Thank you,
> Scott
I do not see anything interesting about this; perhaps you need to explain the problem in more detail.
UT1> select * from marktest2;
FLD1 FLD2 FLD3
---------- ---------- ----------
1 5 10 2 11 20 3 21 30
UT1> select * from marktest2 where fld2 <= &&var and fld3 >= &&var; old 1: select * from marktest2 where fld2 <= &&var and fld3 >= &&var new 1: select * from marktest2 where fld2 <= 15 and fld3 >= 15
FLD1 FLD2 FLD3
---------- ---------- ----------
2 11 20
You query the data similar to above and either get a row back or the no rows. Now if the values were on different rows then that would be more difficult.
HTH -- Mark D Powell -- Received on Fri Dec 13 2002 - 15:14:54 CST
![]() |
![]() |