MAXVALUE is a reserved keyword that serves two major purposes:1. Sequence generator limit – In CREATE SEQUENCE or ALTER SEQUENCE statements, MAXVALUE specifies the greatest value the sequence can return. Once reached, the next value either raises an error (default) or cycles back to MINVALUE if CYCLE is enabled. If MAXVALUE is omitted, the database assigns a very large default (the maximum of the data type).2. Range-partition bound – When defining range partitions, MAXVALUE acts as a sentinel meaning "infinity." It is supplied in the TO (upper) bound so that all values above the preceding partition’s upper limit fall into the partition that ends with MAXVALUE. Only one partition per partition key can use MAXVALUE, and it must be the last in order.Behavior notes:- MAXVALUE applies per sequence; different sequences can have different limits.- Changing MAXVALUE with ALTER SEQUENCE affects only future NEXTVAL operations.- For partitions, MAXVALUE cannot be combined with explicit expressions in the same bound list element.- Not all dialects allow MAXVALUE outside of sequence or partition statements.- Using MAXVALUE without CYCLE on a frequently used sequence risks “sequence exhausted” errors once the limit is hit.
value
(numeric) - The highest integer the sequence can generate or, in partitioning, the literal keyword MAXVALUE indicating an unbounded upper limit.MINVALUE, CREATE SEQUENCE, ALTER SEQUENCE, RANGE PARTITIONING, CYCLE, NEXTVAL
Oracle Database 7 (1992) for sequences
If you omit MAXVALUE, the database sets it to the largest value allowed by the sequence’s data type (e.g., 9223372036854775807 for bigint in PostgreSQL).
No. CYCLE must be specified explicitly. Without CYCLE, reaching MAXVALUE raises an error.
No. The new MAXVALUE must be greater than or equal to the current sequence last_value, or ALTER SEQUENCE will fail.
Keyword spelling is not case-sensitive, but values supplied for sequences are numeric and must follow dialect-specific numeric literal rules.