Reputation: 1175
I am working with hibernate, and a oracle 10 db. I need to get the next sequence value from a table, and want to know how. I saw this article, and asking: is there a better way the get the value, without defining a query?
Thanks!
Upvotes: 1
Views: 2894
Reputation: 116100
No. Getting the next (nextval
) or current (currval
) value from a sequence is typically done using a select. Even in PLSQL, SELECT INTO is used, like this:
SELECT YourSequence.NextVal INTO :new.ID FROM DUAL;
Simple assignment like this won't work:
:new.ID := YourSeqence.NextVal;
Upvotes: 2