Subject Re: Problem with quotes
Author Ali Gökçen
However, real programmers do this: ;)

CREATE PROCEDURE PROC_NOVA_SIFRA_GEN(GEN VARCHAR(50))
RETURNS (SIF BIGINT)
AS
begin

execute statement 'select gen_id('||GEN||',1) from rdb$database'
into :SIF;

if(SIF is not null) then suspend;

WHEN SQLCODE -104 DO
begin
execute statement 'CREATE GENERATOR '||GEN;
execute statement 'select gen_id('||GEN||',1) from rdb$database'
into :SIF;
SUSPEND;
end

end

Don't forget, if more than one user call this proc at the same time
and there is no GEN named GENERATOR, FB will throw an exception
because of DUPLICATE Generator name creation. You should commit
the transaction ASAP if SIF returns as 1.

Regards.
Ali



--- In firebird-support@yahoogroups.com, "miki_avramovic"
<miki.avramovic@g...> wrote:
>
> Thanks a lot Ali Gökçen!
> It works correct!
>
> With Best Regards!
> Miki A