Subject | Re: [firebird-support] New auto-increment column, existing data |
---|---|
Author | Some One |
Post date | 2016-11-17T06:34:55Z |
As said I was a little unclear in my first post, my problem is not to create the autoincrementing field which most of your replies is about but to handle existing table entries. (Neither will I use the rdb$db_key for something persistent.)
However the "character set octets" solved my problem and I also found out how to update the generator value regarding the existing items. Here is my working version:
set term ~ ;
execute block
as
declare dbkey char(8) character set octets;
begin
for
select rdb$db_key
from mytable
into :dbkey
do
begin
update mytable set id = next value for mygenerator
where rdb$db_key = :dbkey;
end
end~
set term ; ~
execute block
as
declare dbkey char(8) character set octets;
begin
for
select rdb$db_key
from mytable
into :dbkey
do
begin
update mytable set id = next value for mygenerator
where rdb$db_key = :dbkey;
end
end~
set term ; ~