oracle - Issue with parameterizing ROWNUM using OracleCommand (C#) using managed ODP.NET -
i trying parameterise rownum when trying query oracle database using latest odp.net managed driver.
sql query "...where rownum <= :rowstolock"
when try add rownum parameter shown below:
dbcommand.parameters.add("rowstolock", oracle.manageddataaccess.client.oracledbtype.int64, 25 , parameterdirection.input);
and try execute query
dbcommand.executenonquery()
i exception:
"additional information: ora-01008: not variables bound"
row num number can see in previous stack overflow post: what oracletype of rownum
however cannot find oracle.manageddataaccess.client.oracledbtype.number. tried other numeric types availabe in oracle.manageddataaccess.client.oracledbtype enum.
i find hard think limitation of managed driver (number type unavailable).
code snippet:
string sql = "...where rownum & lt;= :rowstolock"; string connectionstring = "my connection string"; oracle.manageddataaccess.client.oracleconnection connectiont = new oracle.manageddataaccess.client.oracleconnection(connectionstring); oracle.manageddataaccess.client.oraclecommand dbcommand = new oracle.manageddataaccess.client.oraclecommand(sql, connectiont); dbcommand.parameters.add("rowstolock", oracle.manageddataaccess.client.oracledbtype.decimal, 25, parameterdirection.input); connectiont.open(); int rowsaffected = dbcommand.executenonquery();
complete exception:
ora-01008: not variables bound oracle data provider .net, managed driver @ oracleinternal.serviceobjects.oraclecommandimpl.verifyexecution(oracleconnectionimpl connectionimpl, int32& cursorid, boolean bthrowarraybindrelatederrors, oracleexception& exceptionforarraybinddml, boolean& hasmorerowsindb, boolean bfirstiterationdone) @ oracleinternal.serviceobjects.oraclecommandimpl.verifyexecution(oracleconnectionimpl connectionimpl, int32& cursorid, boolean bthrowarraybindrelatederrors, oracleexception& exceptionforarraybinddml, boolean bfirstiterationdone) @ oracleinternal.serviceobjects.oraclecommandimpl.executenonquery(string commandtext, oracleparametercollection paramcoll, commandtype commandtype, oracleconnectionimpl connectionimpl, int32 longfetchsize, int64 clientinitiallobfs, oracledependencyimpl orcldependencyimpl, int64[]& scnfromexecution, oracleparametercollection& bindbypositionparamcoll, boolean& bbindparampresent, oracleexception& exceptionforarraybinddml, boolean isfromef) @ oracle.manageddataaccess.client.oraclecommand.executenonquery() @ quicktest1.program.main(string[] args) in c:\users\george\documents\visual studio 2015\projects\program.cs:line 44 @ system.appdomain._nexecuteassembly(runtimeassembly assembly, string[] args) @ system.appdomain.executeassembly(string assemblyfile, evidence assemblysecurity, string[] args) @ microsoft.visualstudio.hostingprocess.hostproc.runusersassembly() @ system.threading.threadhelper.threadstart_context(object state) @ system.threading.executioncontext.runinternal(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx) @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx) @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state) @ system.threading.threadhelper.threadstart()
any genuinely appreciated.
the snippet cannot compiled. use dbcommand reference , line after declare it. add parameter , instantiate new instance of oraclecommand. command doesn't have parameter. , expect fail on ora-01745: invalid host/bind variable name because rownum reserved word.
Comments
Post a Comment