P
Pat
Can any one clarify this issue with Managed Oracle Provider in .NET ?
I am trying to run a very simple SQL query using the ExecuteScalar()
method of the command object. I get an error stating: ORA-00911:
invalid character
--------------------Code------------------------
public Object fetchScalar( IDbConnection con, String strSql)
{
IDbCommand cmd = null;
try {
//Prepare the Command
cmd = con.CreateCommand();
cmd.Connection = con;
cmd.CommandText = strSql;
cmd.CommandType = System.Data.CommandType.Text;
try {
cmd.CommandTimeout = 30;
Object result = cmd.ExecuteScalar();
return result;
}
finally {
if (null != cmd) cmd.Connection = null;
cmd = null;
}
}
catch( Exception e ) {
throw new Exception( ERR_CantFetchData, e );
}
}
-------------------End Code---------------------
--------------------SQL-------------------------
select B2.BUS_NAME_ID BusNameId from business_name B1,
business_name B2 where B1.BUS_NAME_ID = 2201110001 and
B1.BUS_NAME_TYPE_CD = 1004 and B1.ENTITY_ID = B2.ENTITY_ID and
B2.BUS_NAME_TYPE_CD = 1001;
-------------------End SQL----------------------
------------------Error Message-----------------
Error: ORA-00911: invalid character
Module: System.Data.OracleClient
at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle
errorHandle, Int32 rc)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle
statementHandle, CommandBehavior behavior, Boolean isReader, Boolean
needRowid, OciHandle& rowidDescriptor, ArrayList&
refCursorParameterOrdinals)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle
statementHandle, CommandBehavior behavior, Boolean needRowid,
OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteScalarInternal(Boolean
needCLStype, Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteScalar()
-----------------End Error----------------------
I am trying to run a very simple SQL query using the ExecuteScalar()
method of the command object. I get an error stating: ORA-00911:
invalid character
--------------------Code------------------------
public Object fetchScalar( IDbConnection con, String strSql)
{
IDbCommand cmd = null;
try {
//Prepare the Command
cmd = con.CreateCommand();
cmd.Connection = con;
cmd.CommandText = strSql;
cmd.CommandType = System.Data.CommandType.Text;
try {
cmd.CommandTimeout = 30;
Object result = cmd.ExecuteScalar();
return result;
}
finally {
if (null != cmd) cmd.Connection = null;
cmd = null;
}
}
catch( Exception e ) {
throw new Exception( ERR_CantFetchData, e );
}
}
-------------------End Code---------------------
--------------------SQL-------------------------
select B2.BUS_NAME_ID BusNameId from business_name B1,
business_name B2 where B1.BUS_NAME_ID = 2201110001 and
B1.BUS_NAME_TYPE_CD = 1004 and B1.ENTITY_ID = B2.ENTITY_ID and
B2.BUS_NAME_TYPE_CD = 1001;
-------------------End SQL----------------------
------------------Error Message-----------------
Error: ORA-00911: invalid character
Module: System.Data.OracleClient
at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle
errorHandle, Int32 rc)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle
statementHandle, CommandBehavior behavior, Boolean isReader, Boolean
needRowid, OciHandle& rowidDescriptor, ArrayList&
refCursorParameterOrdinals)
at System.Data.OracleClient.OracleCommand.Execute(OciHandle
statementHandle, CommandBehavior behavior, Boolean needRowid,
OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteScalarInternal(Boolean
needCLStype, Boolean needRowid, OciHandle& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteScalar()
-----------------End Error----------------------