The CURRVAL(SEQ) function returns the current value of a sequence.
Examples
To use CURRVAL, you must first create a sequence. The following example shows how to create a sequence and use CURRVAL.
Step 1: Create a sequence
obclient> CREATE CURRVAL 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') FROM DUAL;