Dmitry Melekhov wrote:
> 
> Hello!
> 
> I want to have entity beans with server generated  unique primary keys.
> Now I write bean managed persistent beans with Sybase identity fields.
> But this beans would not work with other servers.
> How to generate autoincrement primary keys?
> 
> --
> Dmitry Melekhov
> http://www.aspec.ru/~dm
> 2:5050/11.23@fidonet

I dont know about sybase, but in oracle you create a sequence.

Example syntax:

CREATE SEQUENCE your_seq_name
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOCYCLE;

Example usage:

SELECT your_seq_name.NEXTVALUE FROM DUAL;

SELECT your_seq_name.CURRVALUE FROM DUAL;


I dont know how Sybase solved this, but I hope this will help you.

/Gustaf

Reply via email to