Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: How to get available IDs?

Re: How to get available IDs?

From: Thorsten Kettner <thorsten_kettner_at_my-deja.com>
Date: Thu, 18 Jan 2001 12:54:33 GMT
Message-ID: <946p27$5q$1@nnrp1.deja.com>

Well, seems it was not a beginner's question. Thank you all for trying.



In article <941o49$njk$1_at_nnrp1.deja.com>,   Thorsten Kettner <thorsten_kettner_at_my-deja.com> wrote:
> Hi, I think this is a beginner's question: I want to get all available
> employee numbers by sql to put new employees into the system. If
 emp_no
> is NUMBER(3) then this is how I do it:
>
> SELECT rownum - 1 FROM very_big_table WHERE rownum <= 1000
> MINUS
> SELECT emp_no FROM emp
>
> The problem is that I need that very_big_table to do the trick. If I
> want to to the same for article numbers NUMBER(6) for example, that
> very_big_table had to be even bigger!
>
> Is there another simple way I just haven't thought of? I've thought of
> MIN and MAX from emp, but they don't help as 0 and 999 might be used,
> whereas the other numbers aren't. I have thought about sequences also,
> but a sequence doesn't know about which numbers are still in use, so
 it
> doesn't help either. Any ideas?
>
> Sent via Deja.com
> http://www.deja.com/
>

Sent via Deja.com
http://www.deja.com/ Received on Thu Jan 18 2001 - 06:54:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US