Subject | Re: Problem calling set generator... |
---|---|
Author | phil_hhn |
Post date | 2006-11-07T10:57:54Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
it should read "...then 0 else max(PREF_SN) end..."
run once does 'gen_id' set the value against the GEN_PREFS generator?
(Sorry, just got to know but I can't test for a day ;-) )
>Ummm... my subquery ends with '...from PREFS'?
> At 04:30 PM 7/11/2006, you wrote:
> >SET GENERATOR GEN_PREFS TO (select (case when max(PREF_SN) is null
> >then 1 else max(PREF_SN)+1 end) from PREFS)
>
> Well...partly...a SELECT (even a subquery) needs a FROM clause...
> The generator stores the most recent number generated and willYes thanks, I realised that mistake after my original post (blush) -
> generate a unique new number *next* time - so the value you actually
> want is the max value itself - as long as you're not using the same
> generator for more than one purpose, of course!
it should read "...then 0 else max(PREF_SN) end..."
> select gen_id(GEN_PREFS,(coalesce((select max(PREF_SN) fromerrr... but this will not set the next value (or will it)? I.e after
> WHATEVER),0))) from rdb$database
run once does 'gen_id' set the value against the GEN_PREFS generator?
(Sorry, just got to know but I can't test for a day ;-) )
> Just make sure you have totally exclusive access when you're muckingFor a data pump like this - sure do! :)
> about like this.