Could you please share me some light regarding to primary key operation on Table with Temporal Validity in Oracle?
I have created an table with following schema
Create table TemporalTable_1 (
Customer_ID number(8),
Customer_name varchar2(100),
valid_period_start timestamp,
valid_period_end timestamp,
period for valid_period(valid_period_start, valid_period_end),
constraint TemporalTable_1_PK primary key (Customer_ID , VALID_PERIOD)
)
I have following records from another table "OtherTable" and I need to copy into the TemporalTable_1
Customer_ID | Customer_name | Valid_period_start | Valid_Period_end ------------------+----------------------+-------------------------+----------------------- 00001 | John Chan | 01 JUN 2020 00:00:00 | 09 JUN 2020 23:59:59 00001 | Johnny Chan | 10 JUN 2020 00:00:00 | Null
Following is my script:
insert into TemporalTable_1 select * from OtherTable;
ORA-00001: unique constraint (TemporalTable_1) violated
Before execute the insert statement, the table was blank. So my question is why I am not allowed copy the row into the TemporalTable_1 even the rows have different valid_period.
Is it because Oracle actually didn't care about the valid period column on the primary key?
Thanks in advance!