Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle sequence.nextval returned no rows

I have this SQL script i my app:

select my_seq.nextval from dual connect by level <= 100;

It works great but once I saw (in logs) that it returned no rows at all. Value of sequence is quite far from maximum. I wonder how is it possible at all.

Sequence creation script:

CREATE SEQUENCE my_seq 
MINVALUE 1 MAXVALUE 999999999999999999999999999 
INCREMENT BY 1 START WITH 3602281 
CACHE 2000 NOORDER NOCYCLE;
like image 374
Andrei Petrenko Avatar asked Feb 02 '26 06:02

Andrei Petrenko


1 Answers

There is a small possibility that your DUAL table is empty or that you have a local DUAL table? Try:

select 1 from dual;

If no rows then try:

select 1 from sys.dual;
like image 150
John Doyle Avatar answered Feb 04 '26 01:02

John Doyle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!