Subject | RE: [ib-support] SET GENERATOR in a stored procedure |
---|---|
Author | Lele Gaifax |
Post date | 2003-05-13T09:16:50Z |
>>>>> Alan McDonald l'ha dit:Alan> Sorry, you have to use a script or e.g. IB_Query component
Alan> to reset a generator Alan
Well, that's not completely true: provided you can be sure nobody else
is playing with it, you can do this in an SP:
tempVar = GEN_ID(generator_name, 0);
tempVar = GEN_ID(generator_name, - :tempVar);
that actually reset the generator to zero: the first stmt fetch the
current value, the second *decrements* it by the same amount.
As others said, using GEN_ID(xxx, 0) exposes you to concurrent access
problems.
hth,
bye, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
email: lele@... | -- Fortunato Depero, 1929.