Re: No. of rows selected
Posted in 1998
Adam Sorati wrote: > > Informix On-line 5.x > ISQL 4.x > > Hello, > > I have a cursor in which I create from a query by example, I then use > a foreach statement to display each row. Is there anyway of displaying > the total number of records selected to the user. I looked at the > value of SQLCA.SQLERRD[3] directly after the foreach statement but it > always has a value of zero. > > I am currently using a second cursor to select the count(*) which is > making the selection very slow because I'm doing 2 selection. Adam, I seem to be the bearer of bad tidings today. What you apparently want is fot the engine to tell you how many rows fit a query before you have fetched a single row. Like when you open the cursor. Welcome to the club. Unfortunately, in order to know this answer, the engine would have to actually read (fetch) those rows internally and count them before fetching them and sending them to you. Exactly what you are doing. So you want the engine to always do this for you? When you are running a report and probably don't care about the size of the active set when you start? This extra step would delay results from most queries. Hence the attitude that if you want that count, you gonna have to go and get it yourself. From a business standpoint, I couln't dispute that logic. -- -- Jake (Pondering the color of an asphyxiated smurf) +------------------------------------------------------------+ | The expedient performance of a task with excessive concern | | regarding its duration-to-completion engenders a virtual | | certainty of diminished benefit therefrom. | | -- Benjamin Franklin (but he said it in 3 words) | +------------------------------------------------------------+