Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> sequence of numbers
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-LReceived on Mon Nov 19 2001 - 06:01:53 CST
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
![]() |
![]() |