以十分之一递增的 Firebird 生成器

Firebird generator that increments in tenths

我想使用 Firebird 2.5 创建一个生成器,它每 10 个单位而不是一个一个地递增一列。我在 Firebird 文档和网络上都找不到完成此操作的任何参考。

当使用next value for <sequence name> with a sequence (generator)时,它只能增加一个(Firebird序列没有指定更大值的默认增量的配置):

Each time the NEXT VALUE FOR seq_name operator is used with that sequence, its value increases by 1. The GEN_ID(seq_name, <step>) function can be called instead, to "step" the series by a different integer number.

这也指向一个变通方法:使用增量大于 1 的遗留 gen_id 函数:

Increments a generator or sequence and returns its new value. From Firebird 2.0 onward, the SQL-compliant NEXT VALUE FOR syntax is preferred, except when an increment other than 1 is needed.
[..]
Syntax:

GEN_ID (generator-name, <step>)

换句话说:使用 GEN_ID(<sequence name>, 10) 将序列递增 10 而不是 1。