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!

RETURNING INTO Clause causes ORA-03146: Invalid buffer length for TTC field error

ahmet urunMay 18 2020 — edited May 19 2020

I've come accross with this problem while trying to figure out NHibernate's Identiy sequence mapping. When the Culture is set as Turkish(tr-TR) a query that includes RETURNING INTO statements throws ORA-03146: Invalid buffer length for TTC field error. Same query executes fine when the culture is set as Invariant or en-US. Here is the template for reproducing(I don't know how to refer to a sample project with an Oracle database, if such thing exist I can update the issue with sample project).

            using (OracleConnection oc = new OracleConnection())

            {

                var culture = CultureInfo.GetCultureInfo("tr-TR");

                Thread.CurrentThread.CurrentCulture = culture;

                Thread.CurrentThread.CurrentUICulture = culture;

                oc.ConnectionString = "User ID=<user_id>; Password=<password>; Data Source=<data_source>;";

                oc.Open();

                string sql = "INSERT INTO ALL_SETS_OBJS (SETOBJID, OID, SETID, CLID, PK1, PK2, PK3, PK4) VALUES " +

                    "(ALL_SETS_OBJS_SEQ.nextval, 28601, 818453, 310, '596', '', '', '') returning SETOBJID into :nhIdOutParam";

                OracleCommand cmd = new OracleCommand(sql, oc)

                {

                    CommandType = CommandType.Text

                };

                OracleParameter nhIdOutParam = new OracleParameter

                {

                    OracleDbType = OracleDbType.Decimal

                };

                cmd.Parameters.Add(nhIdOutParam);

                OracleDataReader dr = cmd.ExecuteReader();

                dr.Read();

            }

            Console.ReadLine();

OracleDataReader dr = cmd.ExecuteReader();

                dr.Read();

            }

            Console.ReadLine();

            Console.ReadLine();

Oracle.ManagedDataAccess version 19.7.0

Message was edited by: d9c65753-bb8e-4a3b-8026-d75fccee2bdc

This post has been answered by Alex Keh-Oracle on May 19 2020
Jump to Answer
Comments
Post Details
Added on May 18 2020
1 comment
1,508 views