Subject Re: [ib-support] choice dynamically a generator
Author ibrahim Bulut
You must obkect names in stored procedures and trigger.
You can't use variable object name.
Interbase doesn't excute this procedure
Tip:

IF (ID_KIND=1) THEN SEQUENTIAL = GEN_ID(GEN_KIND_1,1);
IF (ID_KIND=2) THEN SEQUENTIAL = GEN_ID(GEN_KIND_2,1);
IF (ID_KIND=3) THEN SEQUENTIAL = GEN_ID(GEN_KIND_3,1);


----- Original Message -----
From: <enio_bueno@...>
To: <ib-support@yahoogroups.com>
Sent: Monday, November 05, 2001 3:50 PM
Subject: [ib-support] choice dynamically a generator


> 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
>
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>