Subject | choice dynamically a generator |
---|---|
Author | enio_bueno@yahoo.com |
Post date | 2001-11-05T13:50:06Z |
Hi to all
I have a table where I need feeling a field with sequential numbers,
but
this sequential changes to determinate group of registers.
-I have for instance this generators
GEN_KIND_1 current value set to 500
GEN_KIND_2 current value set to 250
GEN_KIND_3 current value set to 1500
-I have this table
CREATE TABLE TESTE
(
ID INTEGER,
ID_KIND INTEGER,
SEQUENTIAL INTEGER
)
if i receive ID_KIND = 2 then sequential must receive 251.
I want calculate this generator in stored procedure, but with out use
several "ifs", I want do some thing like this
...
SEQUENTIAL = GEN_ID("GEN_KIND_" || ID_KIND, 1);
...
but intrerbase dont accept this.
for while I use a TIBSql to execute this 'SELECT GEN_ID(GEN_KIND_' +
ID_KIND,1) FROM RDB$DATABASE', before I call the stored procedure and
then I
pass the 'SEQUENCIAL' by parameter.
so what i really want was calculate all on stored procedure, there
are vary
concurrency access to insert operations in this table (I consider some
danger change directly RDB$GENERATORS)sugestions?
thanks to all
Enio Bueno
I have a table where I need feeling a field with sequential numbers,
but
this sequential changes to determinate group of registers.
-I have for instance this generators
GEN_KIND_1 current value set to 500
GEN_KIND_2 current value set to 250
GEN_KIND_3 current value set to 1500
-I have this table
CREATE TABLE TESTE
(
ID INTEGER,
ID_KIND INTEGER,
SEQUENTIAL INTEGER
)
if i receive ID_KIND = 2 then sequential must receive 251.
I want calculate this generator in stored procedure, but with out use
several "ifs", I want do some thing like this
...
SEQUENTIAL = GEN_ID("GEN_KIND_" || ID_KIND, 1);
...
but intrerbase dont accept this.
for while I use a TIBSql to execute this 'SELECT GEN_ID(GEN_KIND_' +
ID_KIND,1) FROM RDB$DATABASE', before I call the stored procedure and
then I
pass the 'SEQUENCIAL' by parameter.
so what i really want was calculate all on stored procedure, there
are vary
concurrency access to insert operations in this table (I consider some
danger change directly RDB$GENERATORS)sugestions?
thanks to all
Enio Bueno