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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Problem with ODP.NET Managed driver, update nclob raises ORA-01483

mtramullasDec 12 2014 — edited Sep 28 2015

Hello all,

We have a problem with the ODP.NET Managed driver 12.1.0.1.0

We have a table that contains among others, a NCLOB column and a BLOB column. In case we try to set for LONG1, more that 4000 characters, the following happens:

the sentence (1) it works as desired, but when we try to execute the sentence (2) it fails throwing an ORA-01483 exception

a) UPDATE TEST SET LONG_1 = :LONG1, LONG_2=:LONG2  WHERE TEST_ID = 1

b) UPDATE TEST SET LONG_1 = :LONG1, LONG_2=:LONG2  WHERE TEST_ID = :TESTID

This is the test table creation sentence:

  CREATE TABLE "TEST"

   (

     "TEST_ID" NUMBER(10,0),

     "LONG_1" NCLOB,

     "LONG_2" BLOB

   )

We made a WIndows Console application to reproduce it, this is the code:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using Oracle.ManagedDataAccess.Client;

namespace TestOracleNClobProblem

{

    class Program

    {

        static void Main(string[] args)

        {

            const int length = 4001;

            byte[] data2 = new byte[length];

            using (OracleConnection conn = new OracleConnection(<<connection string>>))

            {

                conn.Open();

                StringBuilder data1 = new StringBuilder();

                for (int i = 0; i < length; i++)

                {

                    data1.Append("A");

                    data2[i] = 10;

                }

               

                string sql = "UPDATE TEST SET LONG_1=:LONG1, LONG_2=:LONG2 WHERE TEST_ID = :TESTID";

                using (OracleCommand command = new OracleCommand(sql))

                {

                    command.Connection = conn;

                    command.BindByName = true;

                    command.CommandTimeout = 0;

                    command.Parameters.Add("LONG1", data1.ToString());

                    command.Parameters.Add("LONG2", data2);

                    command.Parameters.Add("TESTID", 1);

                   

                    command.ExecuteNonQuery();  

                }

             }

        }

    }

}

Do anyone have an idea what we are doing wrong?

Thanks in advance

Matias

This post has been answered by Alex Keh-Oracle on Jan 2 2015
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 26 2015
Added on Dec 12 2014
15 comments
4,584 views