Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

how to access CURRVAL NEXTVAL on IDENTITY Oracle 12c columns?

User537222-OracleJul 12 2013 — edited Aug 4 2013

Using Oracle 12c I definedĀ  an identity column:

create table test(col1 number generated by default as identity (start with 1 increment by 1), col2 varchar2(100));

Oracle then generates a sequence for my identity column automatically.

Is there a way (function/call/etc..) to access the CURRVAL / NEXTVAL for that sequence given I don't have the sequence name? (without having to query the system catalog).

I'm trying to avoid the manual creation of a sequence for each of the tables that need auto-numbering and let Oracle administer automatically the sequence creation but I need access to the number just inserted in my identity column when inserting in the row, basically the CURRVAL. Looking forward to use IDENTITY columns...

thank you!

This post has been answered by unknown-7404 on Jul 12 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 1 2013
Added on Jul 12 2013
7 comments
8,518 views