且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

实体框架连接到Oracle:ODP for .NET“不支持时间”;

更新时间:2023-01-22 13:28:45

如果您将日期存储为'2015-06-30 08:13:24',是日期时间文字。

If you have dates stored as '2015-06-30 08:13:24' this is a date time literal.

作为文档状态


ODP.NET不支持与
相关的时间字面量和规范函数时间类型。

ODP.NET does not support Time literals and canonical functions related to the Time type.

在表中查找存储为VARCHAR2的日期。从经验上我可以说EF4至少没有DATE或TIMESTAMP字段的问题,所以您必须将问题放在其他地方。

Look through your tables for dates stored as VARCHAR2. I can say from experience that EF4 at a minimum has no problem with DATE or TIMESTAMP fields so the problem you have has to be somewhere else.

我通常不会考虑存储CHAR变量中的时间。在EF中,我经常不得不将CAST值转换为更可接受的数据类型。例如:

I would not normally consider storing a time in a CHAR variable. In EF I have frequently had to CAST values to a more acceptable datatype. As an example:

select CAST(your_date ||' '||your_time AS DATE) AS your_field from your_table;

在列名中使用Oracle关键字可能会遇到问题。
这是Oracle关键字的列表和保留字。 TIME已包含在列表中。如果您有称为TIME的列名,则可能是问题所在。

You may be running into an issue with using Oracle keywords in your column names. Here is a list of Oracle keywords and reserved words. TIME is included in the list. If you have column names called TIME this could be your problem.

尝试查看将TIME重命名为TIME_T或类似名称的表。

Try making a view of the table where you rename TIME to TIME_T or something.