Subject Re: [firebird-support] Update generators inside a stored procedure
Author Martijn Tonies
Hi,

> I would like to update (or reset) the values of the generators defined
> in the database inside a stored procedure.
>
> I'm trying to do the following:
>
> create procedure UpdateGenTest
> as
> begin
> execute statement gen_id(gen_test, 1);
> end

EXECUTE STATEMENT uses a string parameter, eg:

EXECUTE STATEMENT 'delete from mytable';

> and this does update the value of the generator, BUT it gives the
> following error:
>
> Invalid token.
> Dynamic SQL Error.
> SQL error code = -104.
> Token unknown - line 1, char 1.
> <new value of generator>.
>
> I would be most helpful if anybody could help me out.

myint = gen_id(mygen, 1);

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com