>For a number of reasons, I do not want to use a stored procedure for this.
>What I need to do is a sort of generator on steroids, with a very high power 
>function result. >Thus my code ought to be something like SELECT 
>GEN_ID(GEN_MY_GEN)+POWER(2,32)*MYFIELD
>FROM....
>
>I am at all not sure I can call gen_id that way though, thus probably my best 
>bet is to use a >begin/end pair and perform the calculation outside the 
>select. Do you know if I can do that? >Otherwise, what is the best way to do 
>it? Can I call gen_id in a select?
>
>Thanks

Sure you can call gen_id in a select, Andrea. Though you cannot call 
GEN_ID(GEN_MY_GEN), you have to call GEN_ID(GEN_MY_GEN, 1). Well, it doesn't 
have to be 1, there are scenarios where you only want to know its current value 
and then you would use 0 (and for other reasons you may desire a different 
value).

I've never tried using a generator as part of a calculation (and know nothing 
about Firebird internals), but don't see why it shouldn't work and think SELECT 
GEN_ID(GEN_MY_GEN,1)+POWER(2,32)*MYFIELD FROM ... could be worth a try.

HTH,
Set

Reply via email to