Home > OS >  Oracle sql format max number 99999999999
Oracle sql format max number 99999999999

Time:08-06

Is the number 9999999999999999999999999999 can be written better? I have multiple queries with that value.

CREATE SEQUENCE  "INVOICES_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER  NOCYCLE ;

CodePudding user response:

I don't believe you need to write out the maxvalue. Use NOMAXVALUE, which caps at the 28-digit number.

You could also replace MINVALUE 1 with NOMINVALUE.

ORACLE DOCS:

NOMAXVALUE Specify NOMAXVALUE to indicate a maximum value of 10 27th power for an ascending sequence or -1 for a descending sequence. This is the default.

NOMINVALUE Specify NOMINVALUE to indicate a minimum value of 1 for an ascending sequence or -10 26th power for a descending sequence. This is the default.

CREATE SEQUENCE "invoices_seq" NOMINVALUE NOMAXVALUE INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER NOCYCLE;
  • Related