When I call an Oracle function in a WPF app passing in a date like:
var getRateQry = new StringBuilder();
getRateQry.Append("SELECT fn_get_rate(");
getRateQry.Append(string.Format("TO_DATE('{0}','MM/DD/YYYY HH24:MI:SS')", implemStartDt.ToString(System.Globalization.CultureInfo.InvariantCulture)));
getRateQry.Append(") DUMMY FROM DUAL");
I am returning an ORA-01843 error in OleDB.ExecuteReader(). I pass the date as 04/01/2018 16:00:00 for instance.
But when running a T-SQL query with TO_DATE in the where clause, it works just fine.
I am using VS2010 (set to Win7 compatibility mode since my OS is Win10). What is weird also is that my other colleagues having the same workstation setup doesnt have problems as mine.
I am stuck as I don't know what I have installed last for me to encounter this problem.
UPDATE # 1: My language settings in my workstation is set in English(United States) but I dont think it is related.
When I uninstalled OracleXE (64-bit). Take note: 64-bit. That is when I can run the query in the code correctly. I'll try to install the 32-bit edition as I need it to run SQL Developer and see if the problem will still persist.
Lesson learned: Do not just install 64-bit products just because your OS is a 64-bit.
UPDATE # 2: I can still run the query in code even though OracleXE 32-bit is installed. I am still amazed as to what causes the error if OracleXE 64-bit is installed.
But anyway, I'll let this setup be it for now as this is working for my purpose.