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!

Find the SEQUENCE created by an IDENTITY column

user11763611Aug 5 2013 — edited Aug 5 2013

Hello,

Seems that Oracle 12c introduces IDENTITY columns based on SEQUENCES that are created automatically...

The sequence gets a name like ISEQ$$_<number>

I was wondering if it's possible to find the name of the sequence created for a given table.

We need that to query the last generated number, by doing:

  select <seqname>.currval from dual

Or is there another way to find the last generated number for the current SQL session???

Thanks!

Seb

SQL> create table t1 ( key integer generated by default as identity, c char(10) );

Table created.

SQL> select sequence_name from all_sequences where sequence_name like 'ISEQ%';

SEQUENCE_NAME

--------------------------------------------------------------------------------

ISEQ$$_93989

ISEQ$$_93991

ISEQ$$_93993

ISEQ$$_93995

ISEQ$$_93997

ISEQ$$_94107

6 rows selected.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2013
Added on Aug 5 2013
22 comments
27,060 views