ORA-01002 fetch out of sequenceCause: In a host language program, a FETCH call was issued out of sequence. A successful
parse-and-execute call must be issued before a fetch. This can occur if an attempt was
made to FETCH from an active set after all records have been fetched. This may be caused
by fetching from a SELECT FOR UPDATE cursor after a commit. A PL/SQL cursor loop
implicitly does fetches and may also cause this error. Action: Parse and execute a SQL statement before attempting to fetch the data.
TNS TNS-01002 TNS-01002 stop [listener_name] : stop listenerCause: Control program usage message.Action: No action required.
parse-and-execute call must be issued before a fetch. This can occur if an attempt was
made to FETCH from an active set after all records have been fetched. This may be caused
by fetching from a SELECT FOR UPDATE cursor after a commit. A PL/SQL cursor loop
implicitly does fetches and may also cause this error. Action: Parse and execute a SQL statement before attempting to fetch the data.
TNS TNS-01002 TNS-01002 stop [listener_name] : stop listenerCause: Control program usage message.Action: No action required.
再定义一个序列名,序列号从max(原序列)+1开始,往后定义。
试试。
select seq1.nextval from dual;
看看保不报错,取出的是多少,再查一下当前值
select seq1.currval from dual;与你的sequence定义比较一下
我程序里没有用commit或rollback
数据库
show autocommit是off换了个数据库就出这问题
虽然没有COMMIT,或rollback
但在在同一个过程里,转换数据库就等于提交。
Parse and execute a SQL statement before attempting to fetch the data.