Hi,
I have a problem when inserting an MDSYS.SDO_GEOMETRY object into a Oracle table, which is "ORA-00932: inconsistent datatypes: expected MDSYS.SDO_GEOMETRY got CHAR".
Codes as below:
System.Data.IDbCommand iPUCmd;
CoreLab.Oracle.OracleConnection mConn = new CoreLab.Oracle.OracleConnection("Direct=true;User Id=user;Password=password;sid=sid;server=servername");
mConn.Open();
iPUCmd = mConn.CreateCommand();
iPUCmd.CommandText = "UPDATE table1 SET GEO_OBJ = :GEO_OBJ WHERE ID = 1";
CoreLab.Oracle.OracleParameter s1 = ((CoreLab.Oracle.OracleCommand)iPUCmd).CreateParameter();
s1.ParameterName = "GEO_OBJ";
iPUCmd.Parameters.Add(s1);
string GEO_OBJ="SDO_GEOMETRY(2007, NULL, SDO_POINT_TYPE(2898.759, 13075.253, NULL), SDO_ELEM_INF
O_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(2860.096, 13040.179, 2847.174, 13067.253
, 2883.273, 13084.483, 2910.347, 13097.405, 2937.422, 13110.327, 2950.344, 13083
.253, 2941.319, 13078.945, 2869.121, 13044.486, 2860.096, 13040.179, 2860.096, 1
3040.179))";
((CoreLab.Oracle.OracleParameter)iPUCmd.Parameters[0]).Value = GEO_OBJ;
iPUCmd.ExecuteNonQuery();
How to solve this problem?
Thanks in advance.
How to insert an MDSYS.SDO_GEOMETRY into Oracle table?
-
- Posts: 1
- Joined: Tue 08 Jan 2008 02:23
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24
It looks like the error hides here
->>string<<- GEO_OBJ="SDO_GEOMETRY...
Try to change the “string” type to the “OraleObject”.
Additionally, in the direct mode objects are not supported, therefore you need to connect throughout the client.
Code: Select all
string GEO_OBJ="SDO_GEOMETRY...
Try to change the “string” type to the “OraleObject”.
Additionally, in the direct mode objects are not supported, therefore you need to connect throughout the client.