ORA-08002: sequence string.CURRVAL is not yet defined in this session

文档解释

ORA-08002: sequence string.CURRVAL is not yet defined in this session

Cause: sequence CURRVAL has been selected before sequence NEXTVAL

Action: select NEXTVAL from the sequence before selecting CURRVAL

此错误的意思是当前Session中没有被初始定义的序列sequence string(sequnce string 为自定义序列名称),使用“CURRVAL”保存序列的值,却未成功,因此Oracle抛出该错误。

官方解释

Error: ORA-08002

Text: sequence string.CURRVAL is not yet defined in this session

Cause: An attempt was made to refer to the current value of a sequence number, before it has been initialized.

Action: Use the sequence number function anytime after the sequence number has been initialized.

常见案例

1、使用CURRVAL函数之前,必须先调用NEXTVAL函数

2、可能当前Session回滚了,导致序列已被回滚

正常处理方法及步骤

1、使用NEXTVAL函数初始化序列

2、使用外部变量来保存序列的值,而不是使用CURRVAL函数

你可能感兴趣的