简体   繁体   中英

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 . 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

When you extract year from a date you are getting a number datatype .

So you are trying to update a column with date datatype with number . so you are getting the error.

ORA-00932: inconsistent datatypes: expected DATE got NUMBER.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM