DATA_TYPE 为 DATA
假如 schedule 表中有 DATA 类型的数据,通过语句 select start_date from schedule;
查询出来结果如下,但是没有时分秒。
想要带时分秒,用以下方法:
1. 读出
select to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') from schedule;
// to_char:转化为字符串
2. 写入
insert into schedule(start_date)
values(to_date('2018-05-06 07:52:55', 'YYYY-MM-DD HH24:MI:SS'));
// to_date:转化为 DATE 类型的数据
注意:Oracle 数据库中的 date 类型数据和 Java 当中的 java.sql.Date
对应。