Subject RE: [ib-support] SET GENERATOR in a stored procedure
Author Alan McDonald
I my opinion your logic is wrong is you ever want to get the generator back
without incrementing it... since other users can increment it without your
knowledge, you can never be guaranteed of getting the value you think you
are asking for.
I only ask for the next value - I know it's mine and noone elses so I go
about my business with this value using it where I need it till I've
finished the transaction I am working on.

select GENI_ID(MYGEN, 1) from rdb$database will return the next value.

When I do this type of export, I just use a local integer, inc'ing it's
value on each line to create this line number. It's not usefull anymore
after I have created the export file or sent the export list. So there's no
need to create a generator and reset it's value each time you export. Maybe
you have some other requirements.

Alan

> -----Original Message-----
> From: Tim Ledgerwood [mailto:tim@...]
> Sent: Tuesday, 13 May 2003 6:16 PM
> To: ib-support@yahoogroups.com
> Subject: [ib-support] SET GENERATOR in a stored procedure
>
>
> I suppose I'd better explain the situation :-)
>
> I write software in Delphi that does EFT transfers to banks from retail
> outlets. I am busy converting the software from DBase III + files to
> Interbase / Firebird.
>
> Transactions are sent through to the bank in batches. At the end of each
> batch, a batch cut off message is sent. It is a bank requirement
> that each
> transaction in the batch is individually numbered within that batch, and
> that the transaction sequence numbers in a batch start at 1 in
> each new batch.
>
> So I have a INITBATCH procedure which creates a new batch record and
> returns a set of default values. What I wanted to do was to use the
> generator to generate the values automatically.
>
> Also, how do I select the value in a generator? Can I use the
> following SQL
> in a stored procedure - and if not, how would I get the present value
> without incrementing the generator value?
>
> SELECT * FROM GEN_ID (GEN_MYGENERATOR, 0);
>
>
> [Non-text portions of this message have been removed]
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>