User Tools

Site Tools


oracle:sql:sequence:using_a_sequence_in_a_table_column:from_oracle_12c

This is an old revision of the document!


Oracle - SQL - Sequence - Using a Sequence in a Table Column - From Oracle 12c

From Oracle 12c, a Sequence can be associated with a Table Column via the Identity Column.


Create a table using the identity column for the id column

CREATE TABLE test(
  id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  title VARCHAR2(255) NOT NULL
);

NOTE: This creates a Sequence that is associated with the id column of the table.

  • Because the Sequence is automatically generated for the id column, the name of the sequence may differ each time.
  • Oracle uses the sys.idnseq$ to store the link between the table and the sequence.
oracle/sql/sequence/using_a_sequence_in_a_table_column/from_oracle_12c.1628680946.txt.gz · Last modified: 2021/08/11 11:22 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki