Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: sequence of numbers
Are the numbers actually in sequential order in the mt1 column? If so, you could probably do the following:
select m.row_num
from (select mt1, rownum row_num from mt) m
where m.mt1 > m.row_num
and rownum = 1;
...but it will only work if the values are actually in order for mt1.
Jeffery Stevenson
Databeast Slayer
Medical Present Value, Inc.
Austin, TX
-----Original Message-----
Sent: Monday, November 19, 2001 5:40 AM
To: Multiple recipients of list ORACLE-L
Hello,
I've a table mt ( mt1 NUMBER(10) NOT NULL ) with unique index on the
mt1
column.
There's a sequence of numbers 1,2,3,4,6,7,8,10,11 ... in the mt1
Now, I want to get the smallest number which is not in mt1 (excluding min(mt1)-x of course) into XY (in my example is it n. 5).
When I use SELECT MIN(mt1)-1 INTO XY FROM MT WHERE MT1 NOT IN (select
mt1+1
from mt)
my perfromance goes pretty down :-))) (there's about 5 mil. of numbers).
Some idea how to get it without cursor?
Thanks (and sorry it's monday)
JP
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Jan Pruner
INET: jan_at_pruner.cz
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Mon Nov 19 2001 - 08:42:59 CST
![]() |
![]() |