Re: No. of rows selected
Posted in 1998
Topics: Stored Procedures & SPL
Jacob Salomon wrote: > 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. Why don't you use a single Integer or Smallint variable as a counter? If you are using a foreach loop (as opposed to fetching each row), the computer fetches all the rows of your cursor within your foreach loop. Just set the counter variable to zero before the foreach statement, then within the foreach loop, increment it by one. Hope this helps. Harris harris@traderpub.com