Previous Next

DYNAMIC-NEXT-VALUE function
Returns the next INT64 value of a sequence, incremented by the positive or negative value defined in the specified database.
Syntax 
 
DYNAMIC-NEXT-VALUE( 
  sequence-expression, logical-dbname-expression [ , tenant-id ] )
sequence-expression
A character expression that evaluates to the name of a sequence.
logical-dbname-expression
A character expression that evaluates to the name of a connected database in which the sequence is defined.
tenant-id
An integer expression that evaluates to the tenant ID of a regular tenant, including the default tenant (0). This option applies only to a multi-tenant sequence specified by sequence-expression and is intended for access primarily by a super-tenant user.
If you are a regular-tenant user and you specify tenant-id, the specified tenant must be the same as the tenant associated with the database connection identity for logical-dbname-expression or the AVM raises a run-time error.
If you are a super-tenant user and you do not specify tenant-id, the function assumes the effective tenant ID (GET-EFFECTIVE-TENANT-ID function).
If the sequence specified by sequence-expression is non-multi-tenant (a shared sequence in a multi-tenant database), and you specify tenant-id, the option is ignored.
Notes 
*
If logical-dbname-expression contains the Unknown value (?), the AVM raises a run-time error.
*
If sequence-expression is a cycling sequence, and the DYNAMIC-NEXT-VALUE function increments the sequence beyond its upper limit (for positive increments) or decrements the sequence beyond its lower limit (for negative increments), the function sets and returns the initial value defined for the sequence.
*
If sequence-expression is a terminating sequence, and the DYNAMIC-NEXT-VALUE function attempts to increment the sequence beyond its upper limit (for positive increments) or decrement the sequence beyond its lower limit (for negative increments), the function returns the Unknown value (?) and leaves the current sequence value unchanged. Once a sequence terminates, DYNAMIC-NEXT-VALUE continues to return the Unknown value (?) for the specified sequence until it is reset to a new value with the DYNAMIC-CURRENT-VALUE statement, or its definition is changed to a cycling sequence. After changing the sequence definition to cycle, the first use of DYNAMIC-NEXT-VALUE for the sequence sets and returns its initial value.
*
If sequence-expression is a multi-tenant sequence in the database, each regular tenant has their own current value of the sequence. So, the same values are returned for each tenant that invokes this function. If the sequence is shared in a multi-tenant database, the values returned by this function are unique across all tenants in the database.
Caution:
*
*
*
See also 
CURRENT-VALUE function, CURRENT-VALUE statement, DYNAMIC-CURRENT-VALUE function, DYNAMIC-CURRENT-VALUE statement, NEXT-VALUE function

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.