• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6852
  • Last Modified:

ORA-02289: sequence does not exist

I've inherited another developer's code and this query:

select id_seq.nextval from dual

Is causing this error:

ORA-02289: sequence does not exist
02289. 00000 -  "sequence does not exist"
*Cause:    The specified sequence does not exist, or the user does
           not have the required privilege to perform this operation.
*Action:   Make sure the sequence name is correct, and that you have
           the right to perform the desired operation on this sequence.
Error at Line: 1 Column: 7

I'm pretty sure the user has the required privileges to run this query. How can I fix this?

Thanks.
0
greddin
Asked:
greddin
  • 3
  • 2
1 Solution
 
sdstuberCommented:
3 possibilities

the sequence really does not exist   - check dba_sequences
the user you are using doesn't have privileges   -check dba_tab_privs
a synonym pointing to the sequence doesn't exist  - check dba_synonyms
0
 
sdstuberCommented:
it must be at least 1 of those 3.

When looking for existence, check for misspellings including possible case sensitivity.

For example did somebody create the sequence as "id_seq"  instead of id_seq?  
0
 
greddinAuthor Commented:
Thanks, do I need to use a system user to access and view these dba_sequences, dba_tab_privs, and dba_synonyms tables?

0
 
sdstuberCommented:
you will need to have privileges to read those,  doesn't necessarily mean SYSTEM or other DBA users though.


you can try using the "ALL_" versions instead of "DBA_" versions of the views, but, those are based on permissions.  So, if you don't have permission to read the object then you won't see them in the ALL_ views either, thus giving a false-negative.

If you don't have permission yourself, ask have to ask your DBA or another privileged user to do it for you.
0
 
greddinAuthor Commented:
The sequence didn't exist on this database yet. DBA migrated them over now and all is good.

Thanks for your help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now