tags:

views:

102

answers:

2

I'm new in the Oracle world, and i'm trying to make a insert from .NET (C#) using a parametrized query.

My table is:

CREATE TABLE layer_mapping
(
    lm_id NUMBER NOT NULL,
    lm_layer_name VARCHAR2(50) NOT NULL,
    lm_layer_file LONG RAW NOT NULL,
    CONSTRAINT lm_pk PRIMARY KEY(lm_id)
)

"INSERT INTO layer_mapping VALUES (:lm_id,:lm_layer_name,:lm_layer_file);"

In Visual Studio the query above is being generated on runtime, and I have BindByName = true;

The "lm_layer_file" value, where i suspect the error is, is being fed to a class from a file, and it is a byte array. Below is a example of the class.

public class LayerMapping()
{
    private Int32 _id;
    private String _name;
    private Byte[] _file;
}

The weird thing is that with PostgreSQL everything occurs normaly without errors.

Am i using the wrong methods to generate my long raw values?

Oh, the error that i'm receiving is ORA-0991 (invalid char).

Any thoughts?

A: 

I'd say the first thing you should be doing is using a CLOB in the table, assuming you're on 9i or higher, rather than a LONG RAW. LONGs/LONG RAWs have been obsolescent for a long time -- the only reason Oracle's still keeping them around is because they exist in the data dictionary and Oracle promised to never change it.

Adam Musch
Thanks for the tip. :D
George
+1  A: 

Figured it out:

My sql command builder adds a ';' at the end of the command, but it seems that OracleCommand class does that too.

Solved.

George