Subject Re: whats the opposite of first?
Author Adam
--- In, "nxciro" <pict100@...> wrote:
> here is what i have in a similar situation
> and it puts out the last 10 records in the desc order
> SELECT glno,tc,orgcur,alias FROM GL3 WHERE glno >=
> (GEN_ID(GLNO_GEN,0)-10)
> glno is an integer generated via GLNO_GEN genarator and an
> on insert trigger, works nicely.

Asides from Alan's point regarding deleted records, another area where
you get problems is that generators are outside the transaction. How
do you know the last 5 generated values have been committed yet? What
if the transaction that generated one of the values had to rollback or
was abandoned? It also doesn't work if you are not interested in the
last 10 records, but rather the last 10 records that meet a certain

Whilst there may be some places where such logic is useful, there are
some pretty good reasons to not rely on it.