forked from docs/doc-exports
Reviewed-by: Wagner, Fabian <fabian.wagner@t-systems.com> Co-authored-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-committed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
3.2 KiB
3.2 KiB
Using NEXTVAL or CURRVAL to Query Global Sequence Numbers
- NEXTVAL returns the next sequence number, and CURRVAL returns the current sequence number. nextval(n) returns n unique sequence numbers.
- nextval(n) can be used only in select sequence.nextval(n) and does not support cross-schema operations.
- currval(n) is not supported.
Procedure
- Log in to the required DDM instance using a client.
- Open the required schema.
- Run the following command to create a global sequence:
create sequence seq_test;
- Run the following command to obtain the next sequence number:
select seq_test.nextval;
- Run the following command to obtain the current sequence number:
select seq_test.currval;
- Run the following command to obtain sequence numbers in batches:
select seq_test.nextval(n);
Parent topic: Global Sequence