oracle - Getting an invalid number error at random -
i using next code oracle ado.net provider (devart's dotconnect universal). funny thing works , times throws devart.data.oracle.oracleexception: ora-01722: invalid number
string sql = "select distinct b.price_tier_key,b.label, a.insert_date priceeffectivedate,b.program_key price_program_key ghx_member_tier inner bring together vha_int_price_tier b on a.src_id_value = b.price_tier_key rownum <=100"; dbproviderfactory dpf = dbproviderfactories.getfactory(system.configuration.configurationmanager.connectionstrings["con_ora_devart"].providername); dbconnection conn = dpf.createconnection(); conn.connectionstring = system.configuration.configurationmanager.connectionstrings["con_ora_devart"].connectionstring; dbcommand dbcmd = dpf.createcommand(); dbcmd.connection = conn; //dbcmd.connection = uniconnection1; dbcmd.commandtext = sql; dbcmd.commandtype = commandtype.text; dbcmd.commandtimeout = 0; datatable table = new datatable(); seek { system.data.common.dbdataadapter da = dpf.createdataadapter(); da.selectcommand = dbcmd; // fill datatable. da.fill(table); } grab (exception ex) { throw; } { if (conn != null && conn.state != connectionstate.closed) { conn.close(); conn.dispose(); } if (dbcmd != null) { dbcmd.dispose(); } }
try changing on a.src_id_value = b.price_tier_key
on a.src_id_value = to_char(b.price_tier_key)
.
from the manual: "when comparing character value numeric value, oracle converts character info numeric value.". implicit conversion not safe, need forcefulness oracle convert number string instead.
oracle ado.net devart
No comments:
Post a Comment