How to Insert OracleObject to a table using OracleParameter?

How to Insert OracleObject to a table using OracleParameter?

Postby sujiths_s » Fri 07 Apr 2006 10:15

Hi,
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.

Thanks,
Sujith
sujiths_s
 
Posts: 1
Joined: Fri 07 Apr 2006 09:58

Postby 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);
Paul
 
Posts: 725
Joined: Thu 28 Oct 2004 14:06


Return to dotConnect for Oracle