ชุดข้อมูลของฉันประกอบด้วยคอลัมน์ปี เดือน วัน ชั่วโมง นาที และวินาทีแยกกันดังต่อไปนี้ โดยคั่นด้วยช่องว่าง:
+-------------------+
|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
ได้
column "dt" is of type timestamp without time zone but expression is of type text, You will need to rewrite or cast the expression.
ดูเหมือนจะเป็นคำแนะนำที่ดี คุณลองหรือยัง? - person Mat   schedule 18.11.2012