Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sequence doesn't exist ORA-02289

Tags:

sql

oracle

I have a problem getting my SEQUENCE. I have created a sequence as administrator and have grant select and alter privileges to the other user.

CREATE SEQUENCE  "OWNER"."TOT_SEQ"  MINVALUE 1000 MAXVALUE 1000000000 INCREMENT BY 1 START WITH 1000 CACHE 20 NOORDER  NOCYCLE ;

grant select,ALTER on TOT_SEQ to user;
commit;

When I do this :

select sequence_name from all_sequences;

TOT_SEQ

I can see my SEQUENCE in the list.

But I can't access the sequence in my code. using :

select <SEQUNCE_name>.nextval from dual;

What am I doing wrong?

like image 868
user3752511 Avatar asked Sep 08 '14 14:09

user3752511


People also ask

Why does ora-02289 say sequence does not exist?

ORA-02289: 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. privilege to perform this operation.

What are the details of error ora-02289?

Details of error are as follows. ORA-02289: 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.

What is the cause and action for the sequence not working?

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.

How to create a sequence name using ToT_seq?

CREATE PUBLIC SYNONYM TOT_SEQ for OWNER.TOT_SEQ; SELECT TOT_SEQ.nexval FROM DUAL; Then you will have to fully qualify your sequence name by adding the sequence owner to it.


1 Answers

You will either have to fully qualify your sequence via:

SELECT <owner>.<sequence name>.nextval FROM dual;

Or create a public synonym for it:

CREATE PUBLIC SYNONYM TOT_SEQ for OWNER.TOT_SEQ;
SELECT TOT_SEQ.nexval FROM DUAL;
like image 61
gvenzl Avatar answered Sep 23 '22 04:09

gvenzl