ORA-00001 : Unique Constraint Violated caused by DATE VS Timestamp(6)
Create table tt1 (
dt date primary key
);
Create table tt2(
dt timestamp(6) primary key
);
Insert into tt2 values('25-NOV-13 04.18.47.138746000 PM');
Insert into tt2 values('25-NOV-13 04.18.47.66 PM');
commit;
Insert into tt1 select * from tt2;
ORA-00001: unique constraint violated
unique constraint (%s.%s) violated"
This is because Oracle does not store fractional part for DATE data type. These 2 rows are considered duplicate in TT1. This issue could happen in data migration project if you had not noticed the difference between date and timestamp(6) data type.
dt date primary key
);
Create table tt2(
dt timestamp(6) primary key
);
Insert into tt2 values('25-NOV-13 04.18.47.138746000 PM');
Insert into tt2 values('25-NOV-13 04.18.47.66 PM');
commit;
Insert into tt1 select * from tt2;
ORA-00001: unique constraint violated
unique constraint (%s.%s) violated"
This is because Oracle does not store fractional part for DATE data type. These 2 rows are considered duplicate in TT1. This issue could happen in data migration project if you had not noticed the difference between date and timestamp(6) data type.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/638844/viewspace-1061070/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL: datetime vs timestampMySql
- Oracle中Date和Timestamp的區別Oracle
- [20230207]ANSI DATE and TIMESTAMP SQL syntax.txtSQL
- String和Date、Timestamp之間的轉換
- mysql資料庫date 、datetime、time、timestamp區別MySql資料庫
- Mysql日期(DATE, TIME, DATETIME, TIMESTAMP)型別的比較MySql型別
- 面試題:能談談Date、Datetime、Time、Timestamp、year的區別嗎?面試題
- mysql中的date、datetime、timestamp你還不知道怎麼使用嗎MySql
- python date 和 datetime 的取值範圍(對比 Mysql 的 datetime 和 timestamp)PythonMySql
- 【YashanDB資料庫】自關聯外來鍵插入資料時報錯:YAS-02033 foreign key constraint violated parent key not found資料庫AI
- 約束CONSTRAINTAI
- Could not resolve com.android.support.constraint:constraint-layout:1.1.3AndroidAI
- Will attempt to recover by breaking constraintAI
- PostgreSQL DBA(6) - SeqScan vs IndexScan vs Bit...SQLIndex
- unique 用法
- Unique Array
- Oracle TimestampOracle
- Caused by: android.os.Android
- [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.explicit_defaults_for_timestamp
- TIMESTAMP和TIMESTAMP WITH TIME ZONE之間的總結
- MySQL——約束(constraint)詳解MySqlAI
- partitioned by timestamp datatype
- js實現重寫new Date()相容IE6以上JS
- PTA甲級——Be Unique
- SQL Server Unique ConstratintsSQLServer
- Date
- iOS 常用佈局方式之ConstraintiOSAI
- 10、Oracle中的約 束constraintOracleAI
- JavaScript event.timeStampJavaScript
- 7.71 CURRENT_TIMESTAMP
- Caused by:.NoSuchBeanDefinitionException: No bean named 'userInfoServiceImpl' availableBeanExceptionAI
- Springboot:Caused by: java.lang.NoSuchMethodError...Spring BootJavaError
- Caused by: Error: ' ' is not a valid resource name characterError
- linux解壓報錯gzip: stdin: invalid compressed data--format violatedLinuxORM
- date 物件物件
- JavaScript Date()JavaScript
- Java DateJava
- Date or String
- [20190531]Timestamp Oddity.txt