我正在尝试从 c# 调用 oracle 函数,该函数定义为:
FUNCTION MyFunction(sDate DATE, toLoc VARCHAR2) RETURN VARCHAR2
我的代码如下所示:
cmd.CommandText = "MyFunction";
cmd.CommandType= CommandType.StoredProcedure;
OracleCommandBuilder.DeriveParameters(cmd);
cmd.Parameters["SDATE"].Value = DateTime.Now
cmd.Parameters["TOLOC"].Value = "ABC";
cmd.ExecuteNonQuery();
我也尝试过手动添加参数,将参数类型设置为OracleDbType.Date
. 我不断收到此异常:
Oracle.DataAccess.Client.OracleException was caught
HResult=-2147467259
Message=ORA-01843: not a valid month
ORA-06512: at "MyFunction", line 102
ORA-06512: at line 1
Source=Oracle Data Provider for .NET
ErrorCode=-2147467259