[英]Oracle example value for TIMESTAMP(0) WITH TIME ZONE datatype
Hi how will be example value for the column with datatype of TIMESTAMP
? 嗨,数据类型为
TIMESTAMP
的列的示例值将如何?
Need some insert operation for it. 需要一些插入操作。
createdTime
is datatype of TIMESTAMP(0) WITH TIME ZONE
createdTime
是TIMESTAMP(0) WITH TIME ZONE
数据类型
INSERT INTO table1 values(<id>, <firstName>, <createdTime>);
When I try like the following 当我尝试如下
INSERT INTO table1 values(1, "John", TIMESTAMP '06-APR-14 06.00.42.000000000 PM ASIA/SINGAPORE');
gives the SQL error; 给出SQL错误;
SQL Error: ORA-01843: not a valid month
01843. 00000 - "not a valid month"
If you're using a timestamp literal you have to use a specific format: 如果使用时间戳文字 ,则必须使用特定格式:
INSERT INTO table1 values(1, 'John',
TIMESTAMP '2014-04-06 18:00:42.0 ASIA/SINGAPORE');
You can be more flexible with a to_timestamp_tz
function call: 使用
to_timestamp_tz
函数调用可以更加灵活:
INSERT INTO table1 values(2, 'John',
TO_TIMESTAMP_TZ ('06-APR-14 06.00.42 PM ASIA/SINGAPORE',
'DD-MON-RR HH:MI:SS AM TZR'));
SQL Fiddle demo . SQL Fiddle演示 。
I've omitted the FF
format element since you don't want fractional seconds. 我已经省略了
FF
格式元素,因为您不需要小数秒。
I've also changed the double quotes around John
to single quotes, to stop it being interpreted as an identifier. 我还将
John
周围的双引号更改为单引号,以防止将其解释为标识符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.