Subject Re: [ib-support] more questions on use of generators
Author Ann W. Harrison
At 02:06 PM 11/12/2002 +0800, Jon Perez wrote:

>Sorry, to clarify I meant a SELECT in the form of
>SELECT <function> as in SELECT LAST_INSERT_ID()

What does that mean if you've got triggers which
cascade and cause other inserts? Which is the last
insert?

>which
>makes intuitive sense to me as opposed to Firebird's:
>
>select gen_id(GENNAME, 0) as GenVal from RDB$Database
>
>which I can't figure out how it works because
>gen_id(GENNAME,n) does not return a value by itself,

It does in a complete select statement. It behaves like
other functions - any of the UDF functions for example,
or substring - they all need to be referenced in a query
expression...

>nor does there seem to be any entries in RDB$Database
>if one does a 'select * from RDB$Database'.

Yes, there's one tuple in rdb$database and it contains
the next available relation (i.e. table) id. The rdb$database
table is guaranteed to have exactly one entry and it's used
like the Oracle pseudo table called.... called.... called...
Damn, I hate senility.


Regards,

Ann
www.ibphoenix.com
We have answers.