RE: Divide by zero error doesn't raise
Posted in 2006
A user reported that via ODBC/OLE DB (ADO 2.6, RDO, VB) a SELECT dividing by a zero column returned no rows but raised no error, while dbaccess correctly failed. Others could not reproduce: testing with IDS 9.4, CSDK 2.9, VB6, OLE DB and ADO 2.6 did produce the divide-by-zero error (SQLSTATE 22012). The explanation offered was that the error occurs at fetch time, not at statement execution/cursor open, so it only surfaces when the program actually retrieves/moves onto the offending row — suggesting the caller simply hadn't fetched the data. No further confirmation from the original poster is recorded.
Topics: Connectivity: ODBC / JDBC / .NET
Can the status of the query be captured using an ODBC. Maybe you can do your own error trapping, but yes, the query should return an error, unless you use something like "whenever error continue" -----Original Message----- From: informix-list-bounces@iiug.org [mailto:informix-list-bounces@iiug.org] On Behalf Of agustincb Sent: 10 April 2006 11:47 AM To: informix-list@iiug.org Subject: Divide by zero error doesn't raise I am connecting to informix via ODBC 2.90, the database is version 9.40. I execute this query, for example: SELECT ap_maximo/ap_minimo FROM jam_agrupapesos The table has 8 records, in one of then ap_Minimo = 0; the query just doesn't return any record, but it doesn't fail. This seems to me to be a bug, a REALLY BIG one, it's making me really scared. I tested it too with oledb and the same ¿Any ideas? -- agustincb ------------------------------------------------------------------------ agustincb's Profile: http://www.dbtalk.net/m129 View this thread: http://www.dbtalk.net/t298528 > The information on this e-mail including any attachments relates to the official business of DigiCare (Pty) Ltd. The information is confidential and legally privileged and is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised and as such any disclosure, copying, distribution or any action taken or omitted in reliance on it is unlawful. Please notify the sender immediately if it has inadvertently reached you and do not read, disclose or use the content in any way. > No responsibility whatsoever is accepted by DigiCare (Pty) Ltd if the information is, for whatever reason, corrupted or does not reach its intended destination. The views expressed in this e-mail are the views of the individual sender and should in no way be construed as the views of DigiCare (Pty) Ltd, except where the sender has specifically stated them to be the views of DigiCare (Pty) Ltd. >
when I run a similar query from one of our apps we get ---------------------- Error: An attempt was made to divide by zero. (State:22012, Native Code: FFFFFB4E) looks OK to me really need to contact your support provider and give them specific details of what you are doing that causes this behaviour
when I run a similar query from one of our apps we get ---------------------- Error: An attempt was made to divide by zero. (State:22012, Native Code: FFFFFB4E) looks OK to me really need to contact your support provider and give them specific details of what you are doing that causes this behaviour
I'm connecting through Microsoft ActiveX Data Objects 2.6 Library with a Visual Basic program. I tried it with old RDO 2.0 and it happenned the same thing. In DBACCESS it behaves correctly, it fails. -- agustincb ------------------------------------------------------------------------ agustincb's Profile: http://www.dbtalk.net/m129 View this thread: http://www.dbtalk.net/t298528
Typically, you're going to "execute the statement" and then "retrieve the results". What really happens when you "execute the statement" is that you prepare the statement, declare a cursor, and open the cursor. When you "retrieve the results", you fetch data and it is at this point that the divide by zero actually happens. My guess is that your program hasn't yet retrieved the data... Reece agustincb wrote: > I'm connecting through Microsoft ActiveX Data Objects 2.6 Library with a > Visual Basic program. > > I tried it with old RDO 2.0 and it happenned the same thing. > > In DBACCESS it behaves correctly, it fails. > > > -- > agustincb > ------------------------------------------------------------------------ > agustincb's Profile: http://www.dbtalk.net/m129 > View this thread: http://www.dbtalk.net/t298528
agustincb wrote: > I'm connecting through Microsoft ActiveX Data Objects 2.6 Library with a > Visual Basic program. I just tried it with a combination of IDS9.4, CSDK2.9, VB6, OLEDB and ADO 2.6 and I get a divide by zero error. The error is only caught when I move the cursor onto the record that where the divide by zero ocurred, i.e. I can't see a problem.