oracle:sql:sequence:using_a_sequence_in_a_table_column:prior_to_oracle_12c
This is an old revision of the document!
Table of Contents
Oracle - SQL - Sequence - Using a Sequence in a Table Column - Prior to Oracle 12c
Prior to Oracle 12c, a sequence can only be associated indirectly with a table column at the insert time.
Create a new table
CREATE TABLE test ( id NUMBER PRIMARY KEY, title VARCHAR2(255) NOT NULL ); <\code> ---- ===== CREATE a SEQUENCE FOR the id COLUMN OF the test TABLE ===== <code sql> CREATE SEQUENCE test_id_seq;
Insert data into the test table
INSERT INTO test(id, title) VALUES(test_id_seq.NEXTVAL, 'Create a Test Sequence'); INSERT INTO test(id, title) VALUES(task_id_seq.NEXTVAL, 'Check Sequence Values');
Query data from the test table
SELECT id, title FROM test;
NOTE: The test Table has no direct association with the test_id_seq sequence.
oracle/sql/sequence/using_a_sequence_in_a_table_column/prior_to_oracle_12c.1628680501.txt.gz · Last modified: 2021/08/11 11:15 by peter