maybe help you:
http://www.xaprb.com/blog/2005/12/06/find-missing-numbers-in-a-sequence-with-sql/
In a table I have records with id's 2,4,5,8. How can I receive a list with
values 1,3,6,7. I have tried in this way
>
>SELECT t1.id + 1
>FROM table t1
>WHERE NOT EXISTS (
> SELECT *
> FROM
> In a table I have records with id's 2,4,5,8. How can I receive a list with
> values
> 1,3,6,7. I have tried in this way
>
> SELECT t1.id + 1
> FROM table t1
> WHERE NOT EXISTS (
> SELECT *
> FROM table t2
> WHERE t2.id = t1.id + 1
> )
>
> but it's not working correctly. It doesn't
>> In a table I have records with id's 2,4,5,8. How can I receive a list
>> with values 1,3,6,7. I have tried in this way
>>
>> SELECT t1.id + 1
>> FROM table t1
>> WHERE NOT EXISTS (
>> SELECT *
>> FROM table t2
>> WHERE t2.id = t1.id + 1
>> )
>>
>> but it's not working correctly. I
SET,
> >> In a table I have records with id's 2,4,5,8. How can I receive a list
> >> with values 1,3,6,7. I have tried in this way
> >>
> >> SELECT t1.id + 1
> >> FROM table t1
> >> WHERE NOT EXISTS (
> >> SELECT *
> >> FROM table t2
> >> WHERE t2.id = t1.id + 1
> >> )
> >>
> >> but it
> Once again, your keen I found an error!
I swear, English is my mother tongue. Although, from the above, you'd never
know it!
Once again, your keen *eye* found an error!
At 09:34 a.m. 30/01/2013, Leyne, Sean wrote:
>> Once again, your keen I found an error!
>
>I swear, English is my mother tongue. Although, from the above, you'd never
>know it!
>
>Once again, your keen *eye* found an error!
...and here was eye, thinking you were using Dragon NS to compose your e
>If we are going the EXECUTE BLOCK approach, which I agree would be better.
>
>Then, the optimal logic would be:
>
>execute block returns (id integer) as
>declare variable Next_ID integer;
>begin
> ID = 1;
> FOR
>SELECT ID
>FROM Table
>ORDER BY ID
>