Difference between oracle DATE and TIMESTAMP(oracle DATE 和 TIMESTAMP 的区别)
问题描述
Oracle DATE 和 TIMESTAMP 类型有什么区别?两者都有日期和时间组件?还有这些日期类型在Java中对应的类型是什么?
What are the difference between Oracle DATE and TIMESTAMP type? Both have date and time component? Also what is corresponding type in Java for these date types?
推荐答案
DATE 和 TIMESTAMP 具有相同的大小(7 个字节).这些字节用于存储世纪、十年、年、月、日、小时、分钟和秒.但是 TIMESTAMP 允许存储其他信息,例如小数秒(11 字节)和带时区的小数秒(13 字节).
DATE and TIMESTAMP have the same size (7 bytes). Those bytes are used to store century, decade, year, month, day, hour, minute and seconds. But TIMESTAMP allows to store additional info such as fractional seconds (11 bytes) and fractional seconds with timezone (13 bytes).
TIMESTAMP 被添加为符合 Oracle 的 ANSI.在此之前,它只有 DATE.
TIMESTAMP was added as an ANSI compliant to Oracle. Before that, it had DATE only.
在一般情况下,您应该使用 DATE.但如果需要时间精度,请使用 TIMESTAMP.
In general cases you should use DATE. But if precision in time is a requirement, use TIMESTAMP.
关于 Java,来自 Oracle JDBC 驱动程序的 oracle.sql.DATE 类提供 Oracle 日期/时间戳数据类型与 Java 类 java.sql.Date、java.sql.Time 和 java.sql.Timestamp 之间的转换.
And about Java, the oracle.sql.DATE class from Oracle JDBC driver, provides conversions between the Oracle Date/Timestamp data type and Java classes java.sql.Date, java.sql.Time and java.sql.Timestamp.
这篇关于oracle DATE 和 TIMESTAMP 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:oracle DATE 和 TIMESTAMP 的区别


基础教程推荐
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 在多列上分布任意行 2021-01-01