[英]How to update the value of a column to contain just the year-part of the date?
I have a full date-time in the column ANFISCAL
. 我在ANFISCAL
栏中有一个完整的日期时间。 I would like to update the column to have just the year. 我想将专栏更新为只有一年。
I used 我用了
UPDATE ANIFISCALI SET ANFISCAL=EXTRACT(YEAR FROM ANFISCAL)
but it doesn't work. 但这不起作用。 I'm getting this error: 我收到此错误:
ORA-00932: inconsistent datatypes: expected DATE got NUMBER ORA-00932:数据类型不一致:预期DATE得到NUMBER
When you extract
year
from a date
you are getting a number
datatype
. 从date
extract
year
,您将得到number
datatype
。
So you are trying to update
a column with date
datatype with number
. 因此,您尝试使用带有number
date
数据类型update
一列。 so you are getting the error. 所以你得到了错误。
ORA-00932: inconsistent datatypes: expected DATE got NUMBER. ORA-00932:数据类型不一致:预期DATE得到NUMBER。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.