Subject | Getting ID from generator |
---|---|
Author | Maurice Ling |
Post date | 2005-12-15T02:11:38Z |
Hi,
In my database, I am using a generator to generate a unique ID for one
of my tables and I need to get this ID for input into other tables, is
there a way to do it? That is, getting the last generated ID.
A sample of my DDL is here,
create table microarray_main(
microarrayid numeric (5,0) not null primary key,
description varchar(1024) not null,
submitter char(50) default 'system' not null);
create generator microarray_id_gen;
set generator microarray_id_gen to 10000;
set term !! ; ;
create trigger create_microarray_id for microarray_main
before insert position 0
as begin
new.microarrayid = gen_id(microarray_id_gen, 1);
end !!
set term ; !! !!
When I do an insert into microarray_main table, I need to get the
generated ID (microarrayid) for subsequent work, is there any simple way
to do that?
Thanks
Maurice
[Non-text portions of this message have been removed]
In my database, I am using a generator to generate a unique ID for one
of my tables and I need to get this ID for input into other tables, is
there a way to do it? That is, getting the last generated ID.
A sample of my DDL is here,
create table microarray_main(
microarrayid numeric (5,0) not null primary key,
description varchar(1024) not null,
submitter char(50) default 'system' not null);
create generator microarray_id_gen;
set generator microarray_id_gen to 10000;
set term !! ; ;
create trigger create_microarray_id for microarray_main
before insert position 0
as begin
new.microarrayid = gen_id(microarray_id_gen, 1);
end !!
set term ; !! !!
When I do an insert into microarray_main table, I need to get the
generated ID (microarrayid) for subsequent work, is there any simple way
to do that?
Thanks
Maurice
[Non-text portions of this message have been removed]