create sequence ...
Posted in 2000
Topics: General Discussion
What is the informix equivalent of Oracle's:
CREATE SEQUENCE sequence_nameINCREMENT BY 1 START WITH 1
thax alot,
stefan
Stefan wrote:
> What is the informix equivalent of Oracle's:
>
> CREATE SEQUENCE sequence_name> INCREMENT BY 1 START WITH 1
There isn't a direct analogue of that statement.
Your closest approximation is to use a SERIAL (or SERIAL8)
column.
Or you could do something fancy with a table of sequences
(which would include a name, the start, increment, and the
current values -- plus the wrap and related options which
Oracle allows) and a stored procedure which would take a
sequence name and return you the next value in that sequence.
The principal disadvantage of this would be the concurrency
implications -- the DBMS would hold a lock on the sequence
until your transaction committed.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN
#include <disclaimer.h>