Search code examples
orientdborientdb2.2

Can't use OrientDB sequence in 2.2.16


I've download community 2.2.16 and I'm trying to use sequence in the following way:

DROP SEQUENCE idseq
CREATE SEQUENCE idseq TYPE CACHED START 1 INCREMENT 1 CACHE 20
SELECT SEQUENCE('idseq').next() from V LIMIT 20

But I can't get any values (it's working on 2.2.15) In addition, I know the sequence created since when I'm trying to recreate the index it throws me an error:

Sequence 'IDSEQ' already exists


Solution

  • My problem was that because my DB was empty the way I tried to select values from sequence didn't work and retunes an empty result set.

    Since there isn't DUAL table like in Oracle,
    I changed the query to be:

    SELECT SEQUENCE('idseq').next() from OIdentity LIMIT 20