私のデータセットには、スペースで区切られた次のような年、月、日、時、分、秒の列が含まれています。
+-------------------+
|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
さらに、データ型ごとに統合を実行できます。