Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!wuarchive!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!mips!prls!pyramid!infmx!aland From: aland@infmx.UUCP (Dr. Scump) Newsgroups: comp.databases Subject: Re: Number of Rows from an Informix ESQL statement. Summary: third value in sqlerrd set only for executable statements Message-ID: <2854@infmx.UUCP> Date: 19 Dec 89 02:36:57 GMT References: <590@aut.UUCP> <132@tacitus.tfic.bc.ca> Reply-To: aland@infmx.UUCP (alan denney) Organization: INFORMIX Professional Services ("Peace thru Normalization") Lines: 34 In article <132@tacitus.tfic.bc.ca> clh@tacitus.UUCP (Chris Hermansen) writes: >In article bochner@lange.harvard.edu (Harry Bochner) writes: >>I don't know about ESQL, but from Informix 4gl there really doesn't seem >>to be a way to get at the number of rows found. If you really have to know >What about the SQLERRD[3] in 4GL; the manual (2-72 of 4GL Rapid Development >System, Volume 1) says: > >SQLERRD[3] is the number of rows processed > >??? I don't know, not having used our 4GL much. >Chris Hermansen Timberline Forest Inventory Consultants That third value of sqlerrd (sqlerrd[3] in 4GL and ESQL/COBOL, sqlerrd[2] in ESQL/C) is set only after "executable statements", which excludes cursor operations. For example, if you run an UPDATE, INSERT, or DELETE statement (not using WHERE CURRENT OF on an open cursor), that sqlerrd value does reflect the number of rows updated, inserted [always 0 or 1], or deleted. Also, if you run a SELECT ... INTO TEMP, the number of rows selected/inserted *is* reflected in sqlerrd[x] (since no cursors are involved). Since the number of rows in a cursor can change (depending on what isolation level is in effect), the OPEN and FETCH statements *do not* set sqlerrd[x]. If you *have* to know the approximate number of rows in advance, you can run a select count(*) from ... using the same WHERE clause. -- Alan S. Denney @ Informix Software, Inc. {pyramid|uunet}!infmx!aland "I want to live! -------------------------------------------- as an honest man, Disclaimer: These opinions are mine alone. to get all I deserve If I am caught or killed, the secretary and to give all I can." will disavow any knowledge of my actions. - S. Vega