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

在工具中执行:

select  ar.ar_cash_receipt_history_s.currval from dual; 


出现错误:

ERROR at line 1:
ORA-08002: sequence AR_CASH_RECEIPT_HISTORY_S.CURRVAL is not yet defined in
this session

这是因为在执行.CURRVAL前必须先执行.NEXTVAL, 所以修改SQL语句后可以这样来查询:

select ar_cash_receipt_history_s.nextval next_val,
       ar_cash_receipt_history_s.currval cur_val
  from dual;

官方说法:

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 

你可能感兴趣的:(sql,session,工具)