Subject | RE: Re: [ib-support] Idea for a new field type for FB 2,0 or IB 7? |
---|---|
Author | Helen Borrie |
Post date | 2002-02-08T14:22:05Z |
At 02:55 PM 08-02-02 +0100, you wrote:
...
Last_Num = select Max(serialnum) for SerialNumbers;
New_Num = :Last_Num + 1;
Insert into SerialNumbers (serialnum)
values(:New_Num);
or, a variation:
Last_Num = gen_id(gen_SerialNum,0);
New_Num = :Last_Num = 1;
Insert...etc.
or any variations that do similar stuff in a client application...
The original topic was talking about getting serial-numbering with no gaps. The TI paper suggests a technique for achieving this (with auditing of deletions and recycling of "lost" numbers) using a generator. It discusses the multi-user issues....
regards,
Helen
All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________
>Helen,Briefly, in a multi-user situation, without control over the numbers, more than one user can create the next number in the series. It was a long time since this thread was posted (3 months) but the proposed code went something like this:
>what dangerous situation can happen when maintaining the "own generators values for the auditable series" in a table ... ?
...
Last_Num = select Max(serialnum) for SerialNumbers;
New_Num = :Last_Num + 1;
Insert into SerialNumbers (serialnum)
values(:New_Num);
or, a variation:
Last_Num = gen_id(gen_SerialNum,0);
New_Num = :Last_Num = 1;
Insert...etc.
or any variations that do similar stuff in a client application...
The original topic was talking about getting serial-numbering with no gaps. The TI paper suggests a technique for achieving this (with auditing of deletions and recycling of "lost" numbers) using a generator. It discusses the multi-user issues....
regards,
Helen
All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________