我想在Oracle表中插入Current_timestamp。而且,我尝试过像to_timestamp(current_timestamp,'YYYY-MM-DD HH24:MI:SS:FF')这样的东西,但是它给出的错误是
ORA-01830: date format picture ends before converting entire input string
01830. 00000 - "date format picture ends before converting entire input string"
*Cause:
*Action:我做'select current_timestamp,systimestamp from dual;的时候也非常感谢你的回答,然后它给了我
'CURRENT_TIMESTAMP
--------------------------------------
25-NOV-16 12.03.04.605812000 PM ASIA/C
ALCUTTA ' whereas when i did -'select systimestamp from dual;' I got 'SYSTIMESTAMP
--------------------------------------
25-NOV-16 06.33.04.789680000 AM +00:00 ‘。
现在,我想插入格式25-11月16日06.04.789680000和许多其他的功能。帮帮忙吧。
发布于 2016-11-25 07:00:40
时间戳以数据类型TIMESTAMP WITH TIME ZONE的值返回会话时区中的当前日期和时间。
如果您需要一个TIMESTAMP值,您可以执行CAST(CURRENT_TIMESTAMP AS TIMESTAMP)或更简单的操作,请使用LOCALTIMESTAMP。
根据您最新的问题,您似乎喜欢在时区或数据库服务器上插入时间,即UTC,而不是"Asia/Calcutta“。
在本例中,使用CAST(SYSTIMESTAMP AS TIMESTAMP)或简单地使用SYSTIMESTAMP,甲骨文将在内部转换它。
发布于 2016-11-25 06:17:43
正如@Ed所说,如果您的列是TIMESTAMP,那么只需使用:
insert into yourtable select current_timestamp from dual;或者您的列是VARCHAR,希望更改格式:
insert into yourtable select to_char(current_timestamp, 'YYYY-MM-DD HH12:MI:SS:FF') from dual;https://stackoverflow.com/questions/40798728
复制相似问题