我正在尝试从OracleCommand.Parameter
执行以下操作:
存储过程:
PROCEDURE GetDate(inParam IN VARCHAR2, outDate OUT DATE) AS
BEGIN
SELECT MAX(DateVal) INTO outDate
FROM Table1
WHERE Col1 = inParam;
EXCEPTION
WHEN no_data_found THEN
outDate:= NULL;
END GetDate;
Dim returnDate as Date?
Using Connection = New OracleConnection(connectionString)
Using Command As OracleCommand = Connection.CreateCommand()
Connection.Open()
Command.CommandType = CommandType.StoredProcedure
Command.CommandText = "GEN_PACKAGE.GetDate"
Command.Parameters.Add("inParam", inParam).Direction = ParameterDirection.Input
Command.Parameters.Add("outDate", OracleDbType.Date).Direction = ParameterDirection.Output
Command.ExecuteNonQuery()
If Not CType(Command.Parameters("outDate").Value, INullable).IsNull Then
returnDate = CDate(Command.Parameters("outDate").Value)
End If
End Using
End Using
但是会引发以下异常:
抛出异常:Microsoft.VisualBasic.dll中的'System.InvalidCastException'其他信息:从“ OracleDate”类型到“ Date”类型的转换无效。
如果OracleDbType.Date
无法转换为.NET Date
类型,那有什么意义?我怎样才能将OracleDbType.Date
并以.NET Date
的形式(或日期?,我都尝试过)传递给我?
我正在尝试从OracleCommand.Parameter执行以下操作:存储过程:PROCEDURE GetDate(inParam IN VARCHAR2,outDate OUT DATE)作为开始SELECT MAX(DateVal)INTO outDate ...