I am trying to insert data into an Oracle table using ODP.NET from a C # application, but I get ORA-01400, I cannot insert a null value error for a column in which I DO NOT insert a null value.
This is a stripped-down version of the parameterized SQL command I'm trying to execute. It is wrapped in OracleCommand and executed with an ExecuteNonQuery call:
declare c int; begin select count(*) into c from "Entradas" where "Id" = :Id and nvl("AppId", 0) = nvl(:AppId, 0); if c>0 then update "Entradas" set , "VisitaLaboral" = :VisitaLaboral, where "Id" = :Id and nvl("AppId",0) = nvl(:AppId, 0); else insert into "Entradas" ( , "VisitaLaboral", ) values ( , :VisitaLaboral, ); end if; end;
The line does not exist before, so this is part of the insert command that is executed. Of course, I checked that all column names and column value parameters are correctly placed in the SQL text.
The problem is the VisitaLaboral column. It is of type NUMBER (1,0), it does not accept NULL, and I am trying to insert a value of 0. This is what Visual Studio displays about the associated OracleParameter just before executing the command:

However, if I execute the command directly in the Express application (providing values โโdirectly in the text of the command), it works fine and a line is inserted.
So what is going on here? Is there an error in the ODP.NET library, or am I doing something wrong?
Additional Information:
- Database is Oracle 10g Express Release 10.2.0.1.0
- Oracle.DataAccess.dll version is 4.112.1.2
- Using Visual Studio 2010 targeting the .NET framework 4.0
Thank you in advance!
UPDATE:
Everything works fine if I use the classes (deprecated) of the System.Data.OracleClient instead of ODP.NET.
WTF, Oracle? No, really, WTF?