How to Insert OracleObject to a table using OracleParameter?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Posts: 1
Joined: Fri 07 Apr 2006 09:58

How to Insert OracleObject to a table using OracleParameter?

Post by sujiths_s » Fri 07 Apr 2006 10:15

I have a database table with a column type of object.
I tried the following code to insert an OracleObject but throws exception "illegal variable name/type". Please advise.

corelab_command = new CoreLab.Oracle.OracleCommand();
corelab_command.CommandText = "insert into tap1(c12obj) values(:1)";
corelab_command.Connection = corelab_connection;//it's opened
corelab_p1 = corelab_command.Parameters.Add( "c12obj", CoreLab.Oracle.OracleDbType.Object);
corelab_p1.Direction = ParameterDirection.Input;
corelab_p1.OracleValue = obj;
corelab_p1.ObjectTypeName = "UDT_OBJ_TYPE";
corelab_command.ExecuteNonQuery ();

Please let me know the problem.


Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Mon 10 Apr 2006 09:18

To avoid this error message write parameter name as it is mentioned in the "INSERT" SQL statement.
corelab_command.Parameters.Add( "1", CoreLab.Oracle.OracleDbType.Object);

Post Reply