2
I tried 3 different ways, to make one select
of the last sequence
of my table, but none worked.
SELECT SEQ_ID_PAIS.CURRVAL FROM DUAL;
Error:
ORA-08002: a sequência SEQ_ID_PAIS.CURRVAL ainda não foi definida nesta sessão
08002. 00000 - "sequence %s.CURRVAL is not yet defined in this session"
SELECT LAST_NUMBER FROM SEQ_ID_PAIS;
Error:
ORA-02201: sequência não permitida aqui
02201. 00000 - "sequence not allowed here"
SELECT LAST_VALUE FROM SEQ_ID_PAIS;
Error:
ORA-02201: sequência não permitida aqui
02201. 00000 - "sequence not allowed here"
what would be the correct way to obtain this value ?
@Articuno I thought the error was in the code in java, more realized, that my carelessness was in sql, so I re-asked the question.
– AlunoOracle
Tip: no need to keep erasing and recreating the same question. If no one has answered you, it is because your question is either not very clear or because no one who mastered the subject has yet seen the question. Be patient and whenever possible, edit and improve the question, an hour someone answers.
– user28595
https://www.techonthenet.com/oracle/errors/ora08002.php I think the "currval" can only be called after the "nextval", why you know the last Quence before using it !?
– Motta
@Motta will print on a screen as ID.
– AlunoOracle
Okay, then do after the "nextval".
– Motta
I did not understand very well, I will have to make 2 selects ?
– AlunoOracle