Re: Query to find first missing integer in a field

From: <johnbhurley_at_sbcglobal.net>
Date: Tue, 7 Apr 2009 17:51:27 -0700 (PDT)
Message-ID: <663aa83d-c95f-4cf3-9be8-799f54c35b18_at_g19g2000yql.googlegroups.com>



On Apr 7, 3:51 pm, dean <deanbrow..._at_yahoo.com> wrote:
> Does anyone know a good way to find the first free integer number that
> does not exist in a table in a specified column? I can think of a
> couple of tedious ways of doing this but they are hardly elegant.
> Assume there could be any integer present up to 2 billion.

Why don't you create a new table? Select the data that you want from an existing table get some kind of order by and use rownum as your new not missing integer.

Better yet stay away from the database entirely and stick the data into some spreadsheet and let the excel jockeys fix it any way they wish to as long as they don't put it back in. Received on Tue Apr 07 2009 - 19:51:27 CDT

Original text of this message