Is this a bug in the Oracle ODP.NET

user3245753

I'm curious if this is a bug in the Oracle ODP.NET provider. I created a parameterized insert statement. I named one of the parameters ':EMPNO' and when testing it gave it a value of '8000'. In the database the EMPNO column was defined as varchar2(4 byte). However, the insert gave an error message of

ORA-12899: value too large for column "HR"."HR_DEPARTURE"."EMPNO" (actual: 6, maximum: 4)

Here is some code snipets:

"INSERT INTO HR.HR_DEPARTURE (EMPNO) ':EMPNO'"

I then add a parameter

new OracleParameter(":EMPNO", OracleDbType.Varchar2) {Value = empNo ?? Convert.DBNull}

Create a command and add the parameter (there were multiple parameters thus the array)

DbCommand cmd = Connection.CreateCommand();
cmd.Parameters.AddRange(sqlParams.ToArray());

I did some research and considered things like encoding and the fact that Oracle defaults to bind by position (instead of BindByName). However, none of these resolved the issue. I then took a shot in the dark and changed the parameter name to ":EMPN" and got the following error message:

ORA-12899: value too large for column "HR"."HR_DEPARTURE"."EMPNO" (actual: 5, maximum: 4)

This clued me in to change the parameter name to ":EMP" at which time the query worked. I find it very odd that the provider is enforcing the database column size on the parameter name in c#. The database size should be an enforcement of the value ('8000' which I kept the same in all tests).

SLaks

No; the problem is that your query makes no sense.

':EMPNO' is a string with the literal value :EMPNO, which is five characters long.

To reference a parameter, don't write a string literal.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Is this a bug in the Oracle ODP.NET

From Dev

Oracle ODP.NET error

From Dev

ODP.NET (Oracle Data Provider) schema

From Dev

How to connect Oracle with odp.net without install Oracle client

From Dev

Having trouble querying USER_OBJECTS in Oracle/ODP.NET

From Dev

Performing an Oracle Transaction using C# and ODP.NET

From Dev

Does the Managed Oracle ODP.NET driver utilize network encryption?

From Dev

NLS environment settings and Oracle Managed ODP.Net

From Dev

Entity Framework connect to Oracle: ODP for .NET "does not support time"

From Dev

Passing Record type from Managed ODP.NET to Oracle Procedure

From Dev

Passing array of UDT argument to Oracle Stored Procedure in ODP.NET

From Dev

Replacing TableAdapters with Oracle.DataAccess.Client (ODP.NET)

From Dev

Oracle ODP.Net With Entity Framework 6 - TypeInitializationException - CreateConnection()

From Dev

Data is not inserting oracle table using ODP.NET through asp.net

From Dev

Powershell and odp.net

From Dev

ORA 03134 error connecting ODP.NET 12 (VS2012) to Oracle database 11

From Dev

EF 6 with ODP.Net Oracle.ManagedDataAccess, How to Use Non-Capital Letter for Class Properties?

From Dev

ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file

From Dev

How to make odp.net 12c to work with other oracle client

From Dev

ODP.NET Managed driver throws an exception while connecting to the Oracle Database

From Dev

Oracle ODP.Net With Entity Framework 6 - Entity framework database compatible provider could not be found

From Dev

Oracle managed driver ODP.NET with NHibernate 4.0 FLOAT (126) to C# DECIMAL/Double

From Dev

Getting a Date value from Oracle Stored Procedure using ODP.NET

From Dev

WPF - ODP.NET Managed Driver not working on clients without Oracle client installed

From Dev

How to get .Net Oracle.DataAccess.dll (ODP) to work like MS provided equivalent

From Dev

How to return records from Oracle dynamic SQL in a stored procedure with ODP.NET

From Dev

EF 6 with ODP.Net Oracle.ManagedDataAccess, How to Use Non-Capital Letter for Class Properties?

From Dev

Use Entity Framework with existing ORACLE DB. Visual Studio 2012 and Deprecated ODP.NET Driver

From Dev

How do you connect from ODP.NET to Oracle (12G+) by proxy user with no password

Related Related

  1. 1

    Is this a bug in the Oracle ODP.NET

  2. 2

    Oracle ODP.NET error

  3. 3

    ODP.NET (Oracle Data Provider) schema

  4. 4

    How to connect Oracle with odp.net without install Oracle client

  5. 5

    Having trouble querying USER_OBJECTS in Oracle/ODP.NET

  6. 6

    Performing an Oracle Transaction using C# and ODP.NET

  7. 7

    Does the Managed Oracle ODP.NET driver utilize network encryption?

  8. 8

    NLS environment settings and Oracle Managed ODP.Net

  9. 9

    Entity Framework connect to Oracle: ODP for .NET "does not support time"

  10. 10

    Passing Record type from Managed ODP.NET to Oracle Procedure

  11. 11

    Passing array of UDT argument to Oracle Stored Procedure in ODP.NET

  12. 12

    Replacing TableAdapters with Oracle.DataAccess.Client (ODP.NET)

  13. 13

    Oracle ODP.Net With Entity Framework 6 - TypeInitializationException - CreateConnection()

  14. 14

    Data is not inserting oracle table using ODP.NET through asp.net

  15. 15

    Powershell and odp.net

  16. 16

    ORA 03134 error connecting ODP.NET 12 (VS2012) to Oracle database 11

  17. 17

    EF 6 with ODP.Net Oracle.ManagedDataAccess, How to Use Non-Capital Letter for Class Properties?

  18. 18

    ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file

  19. 19

    How to make odp.net 12c to work with other oracle client

  20. 20

    ODP.NET Managed driver throws an exception while connecting to the Oracle Database

  21. 21

    Oracle ODP.Net With Entity Framework 6 - Entity framework database compatible provider could not be found

  22. 22

    Oracle managed driver ODP.NET with NHibernate 4.0 FLOAT (126) to C# DECIMAL/Double

  23. 23

    Getting a Date value from Oracle Stored Procedure using ODP.NET

  24. 24

    WPF - ODP.NET Managed Driver not working on clients without Oracle client installed

  25. 25

    How to get .Net Oracle.DataAccess.dll (ODP) to work like MS provided equivalent

  26. 26

    How to return records from Oracle dynamic SQL in a stored procedure with ODP.NET

  27. 27

    EF 6 with ODP.Net Oracle.ManagedDataAccess, How to Use Non-Capital Letter for Class Properties?

  28. 28

    Use Entity Framework with existing ORACLE DB. Visual Studio 2012 and Deprecated ODP.NET Driver

  29. 29

    How do you connect from ODP.NET to Oracle (12G+) by proxy user with no password

HotTag

Archive