Subject | Re: whats the opposite of first? |
---|---|
Author | Adam |
Post date | 2006-10-18T23:23:36Z |
--- In firebird-support@yahoogroups.com, "nxciro" <pict100@...> wrote:
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
criteria.
Whilst there may be some places where such logic is useful, there are
some pretty good reasons to not rely on it.
Adam
>Asides from Alan's point regarding deleted records, another area where
> 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.
>
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
criteria.
Whilst there may be some places where such logic is useful, there are
some pretty good reasons to not rely on it.
Adam