Subject RE: [firebird-support] Obtaining the minor number that does not exist
Author Leyne, Sean
> Is it possible to obtain by means of a consultation the minor number that
> does not exist in a status of numbers?

If you are running a version which supports EXECUTE BLOCK you could do:

EXECUTE BLOCK
RETURNS (
FreeInt Integer
) AS
declare variable iFound SmallInt
BEGIN
iFound = 1;
FreeInt = -1;
DO WHILE (iFound = 1) BEGIN
FreeInt = FreeInt + 1;
iFound = 0;
SELECT 1
FROM Table
WHERE ID = (:Freeint + 0)
INTO :iFound;
END
SUSPEND;
END


Sean