【问题标题】:Replacement of DateTime.MinValue in C# to sql将 C# 中的 DateTime.MinValue 替换为 sql
【发布时间】:2025-12-05 18:25:03
【问题描述】:

在 C# 中,我使用了 linq,在其中我使用了最小值的 DateTime。 我将在 oracle 中转换此查询。

select x 
from x in Context.GetRolePlansQuery(AppResources.CurrentUser.Role.RoleId,
                                                                   AppResources.CurrentUser.Loginid,
                                                                   AppResources.CurrentUser.Tpa.TpaId) where
x.LAST_STAGE_COMPLETE.ToUpper() == "RECEIVED"
orderby (x.CDC_COMPLETE_DATE.HasValue ? x.CDC_COMPLETE_DATE : DateTime.MinValue) descending
select x 

我想知道oracle中Min值的服务器日期时间。

【问题讨论】:

标签: c# oracle


【解决方案1】:

这应该可以让你对 oracle sql server 数据类型的取值范围有一个公平的理解: http://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements001.htm#i54330

但是.net对象的最小值和sql server数据类型有区别,DateTime.MinValue的最小值是0001/1/1。

【讨论】: