0

I have a query

CREATE SEQUENCE  "SEQ_ID"  
    MINVALUE 1 
    MAXVALUE 99999 
    INCREMENT BY 1 START WITH 121 
    CACHE 20 
    NOORDER  
    NOCYCLE; 

This one is of oracle commands.

Now, I want to convert into a PostgreSQL command.

How do I replace NO ORDER here.

Prajna
  • 129
  • 1
  • 8

1 Answers1

4

How do I replace NO ORDER here.

Just remove it.

There is no equivalent, and I you probably didn't need (or specify) it in Oracle to begin with.

In Oracle ORDER is only needed in a RAC environment and NOORDER is the default.

So the equivalent would be:

CREATE SEQUENCE seq_id
    MINVALUE 1 
    MAXVALUE 99999 
    INCREMENT BY 1 START WITH 121 
    CACHE 20 
    NO CYCLE; 

I removed the double quotes because you should avoid those dreaded quoted identifiers.

  • THANKS .But if , i have max value as 9999999999999999999999999999, I get an error stating **out of range for type bigint** . CREATE SEQUENCE seq_id MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NO CYCLE ;Please guide!!! @a_horse_with_no_name – Prajna Sep 19 '19 at 12:14
  • Use `NO MAXVALUE` instead –  Sep 19 '19 at 13:11