简体   繁体   English

如何将列的值更新为仅包含日期的年份部分?

[英]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.

相关问题 如何在devexpress -wpf gridcontrol comboboxedit列中添加和显示新值,而不将新值添加到combobox数据源 - How to add and display new value to devexpress -wpf gridcontrol comboboxedit column without adding the new value to the combobox datasource 将列单元格的值绑定到另一个列值 - Binding the value of a column cell to another column value 如何使ComboBox列的编辑器元素保存用户选择的新值? - How to make the ComboBox column's editor elements save the user-selected new value? 当绑定的组合框列的选定值更改时,如何更改其他列的选定值? - when selected value of a bound combobox column changes, how to change selected values for other columns? 在DataGridViewComboBox列上设置值非常慢 - Setting Value on DataGridViewComboBox column very slow 将数据导入DatagridComboBoxColumn不会更新组合列表值 - Importing data into DatagridComboBoxColumn does not update combo list value DataGridComboBoxColumn更改后如何更新数据库? - How to update a database after a DataGridComboBoxColumn has changed? 如何动态更新datagrid中对comboxboxcolumn的选择? - how do I dynamically update the selection of comboxboxcolumn in datagrid? DataGridView的自定义ComboBox列 - Custom ComboBox Column for DataGridView 如何在WPF Datagrid comboBox列中插入静态值? - How to insert static values in wpf datagrid comboBox column?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM