highgo=# create table test_aa (c1 date);
CREATE TABLE
highgo=# insert into test_aa values (to_date('2018-06-05 19:55:44' ,'yyyy-mm-dd hh24:mi:ss'));
INSERT 0 1
highgo=# insert into test_aa values (to_date('2018-06-05 03:55:44' ,'yyyy-mm-dd hh24:mi:ss'));
INSERT 0 1
highgo=# insert into test_aa values (to_date('2018-06-06 13:55:44' ,'yyyy-mm-dd hh24:mi:ss'));
INSERT 0 1
highgo=# select * from test_aa;
c1
------------
2018-06-05
2018-06-05
2018-06-06
(3 rows)
highgo=# 结论:pg中的date数据类型是指年-月-日,不包括时-分-秒
oracle中的date数据类型是指"年-月-日 时-分-秒"
本文通过创建表并插入不同格式的日期数据,对比了PostgreSQL (PG) 和 Oracle 数据库中 date 数据类型的差异。PG 的 date 类型仅包含年月日信息,而 Oracle 的 date 类型则包含了完整的日期时间信息。
1137

被折叠的 条评论
为什么被折叠?



