How to create generator in SP

Of course InterBase has command CREATE GENERATOR, but because it is DDL command, you can’t use it in stored procedure. But thanks to system of active tables, you can create generator by inserting it’s name directly into system table:

INSERT INTO RDB$GENERATORS (RDB$GENERATOR_NAME)
VALUES (UPPER('MYGEN'));

The new generator is available immediately, even before commit (but if you rollback, the generator-name/generator-id will be lost). Do not forget that most IB versions have bug that prevents you from creating and using too many generators.

1 Comentário »

  1. Maiquel said

    Deu certinho muito obrigado pela dica, salvou minha vida! hehe.. valeu

RSS feed for comments on this post · TrackBack URI

Deixe um comentário