Subject SELECT MAX() or Generator
Author William L. Thomson Jr.
Some time back, I stopped using Generators. I had to many issues with
bad code or commits, incrementing, and not decrementing the generator.
At times I would get gaps in numbers and etc. Overall working with them
became a pain. I came up with a similiar way using a simple trigger, and
was just curious to others thoughts on it.

DECLARE VARIABLE max_num INTEGER;
BEGIN
IF(new.NUM is NULL)
THEN
BEGIN
SELECT MAX(NUM) FROM MY_TABLE INTO max_num;
new.NUM = max_num+1;
END
END

I have been doing this for quite some time. Can't tell much if any
difference on performance. If I delete a bunch of records in order, like
the last 5 or 10. I do not have to worry about resetting, syncing,
updating the generator. Or decrementing the generator at all.

Anyway thought I would toss it out there. I would assume others to
already be doing something similar?

--
Sincerely,
William L. Thomson Jr.
Obsidian-Studios, Inc.
http://www.obsidian-studios.com