Subject | Re: [ib-support] SET GENERATOR in a stored procedure |
---|---|
Author | Martijn Tonies |
Post date | 2003-05-13T08:17:19Z |
Hi Tim,
myvar = GEN_ID(mygen, 0);
You cannot SET a generator because that's a DDL statement. These
are not allowed inside procedures.
Is it absolutely required to reset the generator?
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com
See you at the First European Firebird Conference in May in Fulda, Germany
http://www.firebird-conference.com
> I suppose I'd better explain the situation :-)batch.
>
> 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
>SQL
> 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
> in a stored procedure - and if not, how would I get the present valueHow about simply:
> without incrementing the generator value?
>
> SELECT * FROM GEN_ID (GEN_MYGENERATOR, 0);
myvar = GEN_ID(mygen, 0);
You cannot SET a generator because that's a DDL statement. These
are not allowed inside procedures.
Is it absolutely required to reset the generator?
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com
See you at the First European Firebird Conference in May in Fulda, Germany
http://www.firebird-conference.com