Oracle 23.26SQLLab-verified · 2026-11-29

ORA-02289: sequence does not exist

The sequence name used with NEXTVAL/CURRVAL cannot be found in the schema the statement looks in.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-02289: sequence does not exist

Jump to a cause

  1. 01Typo in the sequence name
  2. 02Another schema's sequence used without the owner name

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-29 · container image gvenzl/oracle-free:23-slim

ORA-02289 appears when name.NEXTVAL or name.CURRVAL points to a sequence Oracle cannot find. Without owner. in front, Oracle looks in your own schema (and then for a synonym).

The two runs below are the usual causes. Start with SELECT sequence_name FROM user_sequences or, for other schemas, all_sequences.

01Typo in the sequence name

The sequence was created as ORDERS_SEQ, but the INSERT used order_seq.NEXTVAL and failed with ORA-02289. The asterisk points at the sequence name.

user_sequences listed ORDERS_SEQ. With orders_seq.NEXTVAL the INSERT worked and the row got id 1.

Setup
Setuprun as lab_a
CREATE TABLE orders (id NUMBER PRIMARY KEY, amount NUMBER);
CREATE SEQUENCE orders_seq;
OUTPUT
Table created.


Sequence created.
Reproducerun as lab_a
INSERT INTO orders VALUES (order_seq.NEXTVAL, 100);
✕ ERROR
INSERT INTO orders VALUES (order_seq.NEXTVAL, 100)
                           *
ERROR at line 1:
ORA-02289: sequence does not exist
Help: https://docs.oracle.com/error-help/db/ora-02289/
Checkrun as lab_a
COLUMN sequence_name FORMAT A14
SELECT sequence_name, last_number FROM user_sequences;
OUTPUT
SEQUENCE_NAME  LAST_NUMBER
-------------- -----------
ORDERS_SEQ               1

1 row selected.
After the fixrun as lab_a
INSERT INTO orders VALUES (orders_seq.NEXTVAL, 100);
SELECT id, amount FROM orders;
✓ SUCCESS
1 row created.


        ID     AMOUNT
---------- ----------
         1        100

1 row selected.

02Another schema's sequence used without the owner name

LAB_A owned ORDERS_SEQ and granted SELECT on it to LAB_B. LAB_B still got ORA-02289 from SELECT orders_seq.NEXTVAL FROM dual, because the name was looked up in the LAB_B schema.

all_sequences showed SEQUENCE_OWNER LAB_A. lab_a.orders_seq.NEXTVAL returned 1. After CREATE SYNONYM orders_seq FOR lab_a.orders_seq, the short name orders_seq.NEXTVAL also worked and returned 2.

Setup
Setuprun as lab_a
CREATE SEQUENCE orders_seq;
GRANT SELECT ON orders_seq TO lab_b;
OUTPUT
Sequence created.


Grant succeeded.
Reproducerun as lab_b
SELECT orders_seq.NEXTVAL FROM dual;
✕ ERROR
SELECT orders_seq.NEXTVAL FROM dual
       *
ERROR at line 1:
ORA-02289: sequence does not exist
Help: https://docs.oracle.com/error-help/db/ora-02289/
Checkrun as lab_b
COLUMN sequence_owner FORMAT A10
COLUMN sequence_name FORMAT A12
SELECT sequence_owner, sequence_name FROM all_sequences WHERE sequence_name = 'ORDERS_SEQ';
OUTPUT
SEQUENCE_O SEQUENCE_NAM
---------- ------------
LAB_A      ORDERS_SEQ

1 row selected.
Fixrun as lab_b
CREATE SYNONYM orders_seq FOR lab_a.orders_seq;
OUTPUT
Synonym created.
After the fixrun as lab_b
SELECT lab_a.orders_seq.NEXTVAL AS by_owner FROM dual;
SELECT orders_seq.NEXTVAL AS by_synonym FROM dual;
✓ SUCCESS
  BY_OWNER
----------
         1

1 row selected.


BY_SYNONYM
----------
         2

1 row selected.

FAQ

How do I check if a sequence exists in Oracle?

Your own: SELECT sequence_name, last_number FROM user_sequences;. Any schema you can see: SELECT sequence_owner, sequence_name FROM all_sequences WHERE sequence_name = 'NAME';.

The sequence exists and I have SELECT on it, but I still get ORA-02289. Why?

You are probably calling it without the owner. Write owner.seq.NEXTVAL, or create a synonym (CREATE SYNONYM seq FOR owner.seq) so the short name works.

Do I need a grant to use another user's sequence?

Yes, SELECT on the sequence. In the run above the grant was given and ORA-02289 still appeared until the owner name or a synonym was used. On 23ai, using another schema's sequence without any grant returned ORA-00942 instead of ORA-02289.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0