Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Running an update query with Oracle.ManagedDataAccess.Core throws index out of bounds exception

4234439Apr 18 2020 — edited Apr 28 2020

When I run the below code using ManagedDataAccess nuget package (v19.6.0), it throws an index out of bounds exception. How do I retrieve the return value in the update statement?

var sql = "UPDATE SOMETABLE SET LAST_UPDATED = SYSDATE WHERE ID = 123 RETURNING INFO INTO :un";

OracleCommand cmd = new OracleCommand(sql, dbConn);

OracleParameter un = new OracleParameter(":un", OracleDbType.Varchar2, 30);

un.Direction = ParameterDirection.ReturnValue;

cmd.Parameters.Add(un);

dbConn.Open();

cmd.ExecuteNonQuery();

INFO isĀ  a varchar2(30) column. I get the same error when using the Core version of the nuget package (V2.19.60).

If I use System.Data.OracleClient and replace OracleDbType.Varchar2 with OracleType.Varchar, which is deprecated, and run the same code as above, it works just fine.

Any help is greatly appreciated!

Comments
Post Details
Added on Apr 18 2020
12 comments
1,796 views