Subject | Re: Updating generator |
---|---|
Author | Svein Erling |
Post date | 2004-05-11T08:03:44Z |
--- In firebird-support@yahoogroups.com, "Martijn Tonies" wrote:
SELECT GEN_ID(CALLDATA_GEN, 1-GEN_ID(CALLDATA_GEN, 0))
from rdb$database
(well, the generator could get another value than 1 if someone managed
to use it between the two calls to CALLDATA_GEN, but I assume that if
someone wants to set a generator to 1, then that 'someone' is the only
person actually using the generator at the current time).
Set
> Hi,A "no-DDL-way" to do this would be
>
> > could I update generator from the stored procedure?
> > I tried:
> >
> > SET TERM !! ;
> > CREATE OR ALTER PROCEDURE PT_UpdateGenerators
> > AS
> > BEGIN
> > SET GENERATOR CALLDATA_GEN TO 1;
> > END
> > !!
> > SET TERM ; !!
> >
> > But isql says:
> > Statement failed, SQLCODE = -104
> > Dynamic SQL Error
> > -SQL error code = -104
> > -Token unknown - line 8, char 1
> > -set
>
> You cannot do DDL statements inside a procedure, except
> with EXECUTE STATEMENT.
SELECT GEN_ID(CALLDATA_GEN, 1-GEN_ID(CALLDATA_GEN, 0))
from rdb$database
(well, the generator could get another value than 1 if someone managed
to use it between the two calls to CALLDATA_GEN, but I assume that if
someone wants to set a generator to 1, then that 'someone' is the only
person actually using the generator at the current time).
Set