我的数据集包含单独的年、月、日、小时、分钟和第二列,如下所示,以空格分隔:
+-------------------+
|2007|09|28|21|14|06|
|2007|09|28|21|14|06|
|2007|09|28|21|14|06|
|2007|09|28|21|14|06|
|2007|09|28|21|14|06|
+-------------------+
我想将它们集成为时间戳数据类型下的单个列。我在时间戳数据类型中创建了一个新列,并通过以下代码更新该列:
Update s2
set dt = year || '-' || month || '-' || day
|| ' ' || hour || ':' || min || ':' || second
但是我遇到了以下错误:
ERROR: column "dt" is of type timestamp without time zone but expression is of type text
LINE 1: Update temp set dt= year || '-' || month || '-' || day ||...
^
HINT: You will need to rewrite or cast the expression.
********** Error **********
ERROR: column "dt" is of type timestamp without time zone but expression is of type text
SQL state: 42804
Hint: You will need to rewrite or cast the expression.
Character: 22
此外,我可以按varchar
数据类型进行集成。