Hello! In the FB guide reads:
"Setting a generator directly to a certain value (“Update”)
PSQL
GEN_ID(<GeneratorName>,<NewValue> - GEN_ID(<GeneratorName>, 0 ) );
Warning
This is more of a dirty little trick to do what you normally cannot
and should not do in SPs and triggers: /setting/ generators. They
are for /getting/, not /setting/ values."
I have a trigger, that fills a field with a new value if the field is
empty and if it is not empty, just set the new value to the generator
(the field *is not* a PK, so there's no problem is someone alter the
value a duplicate some numbers... This is the part of the trigger:
if ((new.numero <= 0) or (new.numero is null)) then
new.numero = gen_id(gen_nro_ret_iibb, 1);
else
void = gen_id( gen_nro_ret_iibb, 1+ new.numero -
gen_id(gen_nro_ret_iibb,0) );
So... if the advice of the guide is not to do it... what is the "proper"
way to do it??? What are the actual risks of doing that??
thanks!!!!!!!
-s
------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/