This discussion is archived
0 Replies Latest reply: Apr 3, 2013 12:23 AM by zeroid RSS

EF execution of stored procedure with DATE parameter loses hours/minutes

zeroid Newbie
Currently Being Moderated
I have a simple stored procedure using DATE as an input:

CREATE OR REPLACE PROCEDURE delete_time(myTime DATE) IS
BEGIN
DELETE FROM mytable WHERE time = myTime;
END;
/

This has been added to my EDMX using a function import, and the types mapped are Date on the SSDL side and DateTime on the CSDL.

The problem is when I run the procedure from .NET using a DateTime the hours and minutes are lost somewhere along the way:

DateTime dt = new DateTime(2013, 4, 3, 12, 15, 00);
var timeParam = new ObjectParameter("myTime", dt) :
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("DeleteTime", timeParam);

This runs the stored procedure but deletes the rows where TIME = 03-APR-2013 00:00:00 instead of 03-APR-2013 12:15:00

Is there some bug in the Oracle client (I'm using 11.2.0.3.20)? Or am I doing something wrong above?

I also tried using TIMESTAMP as the input type of my procedure, but then I get this error when calling the function:
ORA-01830: date format picture ends before converting entire input string

Any ideas?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points