Create a SEQUENCE and retrieve the value
SQL>
SQL> CREATE SEQUENCE supplier_seq
2 MINVALUE 1
3 MAXVALUE 999999999999999999999999999
4 START WITH 1
5 INCREMENT BY 1
6 CACHE 20;
Sequence created.
SQL>
SQL> select supplier_seq.nextval from dual;
NEXTVAL
----------
1
SQL> select supplier_seq.nextval from dual;
NEXTVAL
----------
2
SQL> select supplier_seq.nextval from dual;
NEXTVAL
----------
3
SQL> select supplier_seq.nextval from dual;
NEXTVAL
----------
4
SQL>
SQL> drop sequence supplier_seq;
Sequence dropped.
SQL>
SQL>
Related examples in the same category