Subject | Re: [firebird-support] Set generator in execute block |
---|---|
Author | Si Carter |
Post date | 2012-02-09T21:05:26Z |
Worked a treat thankyou
Si
2012/2/9 Svein Erling Tysvær <svein.erling.tysvaer@...>
Si
2012/2/9 Svein Erling Tysvær <svein.erling.tysvaer@...>
> **[Non-text portions of this message have been removed]
> Why not:
>
> EXECUTE BLOCK
> AS
> DECLARE VARIABLE vMaxID INTEGER;
> DECLARE VARIABLE Dummy INTEGER;
> BEGIN
> SELECT MAX(PK_TABLE_B) FROM TABLE_B
> INTO :vMaxID ;
> DUMMY = GEN_ID(TABLE_B_GEN, :vMaxID - GEN_ID(TABLE_B_GEN,
> -GEN_ID(TABLE_B_GEN,0)));
> END ^
>
> The inner GEN_ID will set the generator to 0, the outer to vMaxID.
>
> HTH,
> Set
>
> __._,
>