oracle中如何插入时间,如何在Oracle中插入时间戳?

7

Kind of depends on where the value you want to insert is coming from. If you want to insert the current time you can use CURRENT_TIMESTAMP as shown in other answers (or SYSTIMESTAMP).

这取决于你想要插入的值来自哪里。如果想插入当前时间,可以使用CURRENT_TIMESTAMP,如其他答案(或SYSTIMESTAMP)所示。

If you have a time as a string and want to convert it to a timestamp, use an expression like

如果您有一个时间作为字符串,并希望将其转换为时间戳,请使用类似的表达式

to_timestamp(:timestamp_as_string,'MM/DD/YYYY HH24:MI:SS.FF3')

The time format components are, I hope, self-explanatory, except that FF3 means 3 digits of sub-second precision. You can go as high as 6 digits of precision.

我希望,时间格式组件是不言自明的,但FF3表示的是次秒精度的3位数。你可以达到6位数的精度。

If you are inserting from an application, the best answer may depend on how the date/time value is stored in your language. For instance you can map certain Java objects directly to a TIMESTAMP column, but you need to understand the JDBC type mappings.

如果是从应用程序中插入,最好的答案可能取决于日期/时间值在语言中的存储方式。例如,可以将某些Java对象直接映射到时间戳列,但是需要理解JDBC类型映射。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值