Subject Re: where the generators values located?
Author Adam
Hello,

The generator values are not stored there. In any case, why did you
want to do this for? There are probably better ways to do what you
are trying to do.

With that disclaimer, here is a simple stored procedure can fetch
them for you (requires FB 1.5+), but do tell why you need it.



CREATE PROCEDURE SP_GET_GENERATOR_VALUES
RETURNS
(
GENERATOR_NAME VARCHAR(50),
CURRENT_VALUE BIGINT
)
AS
DECLARE VARIABLE STMT VARCHAR(300);
BEGIN
FOR SELECT RDB$GENERATOR_NAME
FROM RDB$GENERATORS
WHERE RDB$SYSTEM_FLAG IS NULL
ORDER BY RDB$GENERATOR_NAME
INTO :GENERATOR_NAME
DO
BEGIN
STMT = 'SELECT GEN_ID(' || :GENERATOR_NAME || ', 0) FROM
RDB$DATABASE';
EXECUTE STATEMENT STMT INTO :CURRENT_VALUE;
SUSPEND;
END
END
^

Adam




--- In firebird-support@yahoogroups.com, "jameschua1021"
<cai.haibin@g...> wrote:
> Anyone who can point me in which system table can I see all my
> generators and their current value?
>
> Thanks
>
> Apinot