ORA-01461: can bind a LONG value only for insert into a LONG

ORA-01461: can bind a LONG value only for insert into a LONG

Postby slaxman » Mon 12 Jul 2010 21:55

I am guessing that the above error is due to Guid->Raw mapping. Here is the parameter mapping code.
Code: Select all
               
if (paramValue.GetType() == typeof(Guid))
{
      Devart.Data.Oracle.OracleParameter orclParam = param as Devart.Data.Oracle.OracleParameter;
      if (orclParam != null)
           orclParam.OracleDbType = Devart.Data.Oracle.OracleDbType.Raw;
}

In debug I see that this mapping code is executed but the query fails later with ORA-01461 error for some reason.

also, I tried setting the DbType to 'Binary'. That resulted in this error
{"ora-00932: inconsistent datatypes: expected - got blob"}

any ideas?


thanks
slaxman
 
Posts: 47
Joined: Wed 16 Sep 2009 20:09
Location: United States

Postby StanislavK » Tue 13 Jul 2010 13:42

Could you please specify how the param object is defined and what query you are trying to execute? If possible, please send us a small test project including the scripts needed to create the database objects.

I've tried the following code and the Guid parameter was inserted successfully:
Code: Select all
OracleParameter orclParam = new OracleParameter("rawParam", OracleDbType.Raw, 16);
orclParam.Value = Guid.NewGuid();

OracleCommand command = new OracleCommand
    ("insert into TestRawTable(rawColumn) values (:rawParam)", connection);
command.Parameters.Add(orclParam);
command.ExecuteNonQuery();

The TestRawTable table is defined as
Code: Select all
CREATE TABLE TestRawTable
(
  rawColumn RAW(16),
  CONSTRAINT PK_TestRawTable PRIMARY KEY (rawColumn)
)
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

solved: it is due to Unicode setting

Postby slaxman » Thu 15 Jul 2010 22:43

It was not the Guid field that was causing it but another field of type nvarchar2. with 'Unicode'set to true in the connection, the error went away.
slaxman
 
Posts: 47
Joined: Wed 16 Sep 2009 20:09
Location: United States

Postby StanislavK » Fri 16 Jul 2010 06:40

Glad to see that the problem was resolved.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for Oracle