The CURRVAL(SEQ) function returns the current value of a sequence.
Usage example
To use the CURRVAL function, you must first create a sequence. The following example shows how to create a sequence and use the CURRVAL function.
Step 1: Create a sequence
obclient> CREATE SEQUENCE students_seq;
Step 2: Use NEXTVAL to insert new data
obclient> INSERT INTO students (id, name) VALUES (students_seq.NEXTVAL, 'John Doe');
Step 3: Use CURRVAL to get the current value
obclient> SELECT currval('students_seq');