Re: 4gl, cursor and count
Posted in 2000
On Tue, 26 Sep 2000, ROBERT B VORBROKER wrote: >Frank Fischer <FischerF@lsv-gartenbau.de> wrote: >> i have a cursor and i want to now how many records are inside this. >> I don't now the syntax and I couldn't find something in the handbooks. >> Can anyone help me? > >OK my memory is a bit foggy on this one but once you have opened the cursor >can't you check one of the values of SQLCA record to see how many rows were >selected. Only after the last row has been selected. If you have a non-scroll cursor, then you have to do FETCH for each row; once you get NOTFOUND, you can poke in SQLCA to find out how many rows you fetched (or you can count them yourself). If you have a scroll cursor, you can do FETCH LAST and then get the answer. Of course, the DBMS has worked out which rows are involved and stashed them all away for use. I note that MySQL actually gives the answer immediately after you open the cursor. Of course, that has its own set of implications for performance and locking and so on. >Can someone flesh out my memory???...I'm having sometimers disease... > >OPEN cursor_name >Let l_num_rows = SQLCA. something... > >Obnoxio, Art, Someone??? I guess Someone is responding... -- Yours, Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN "I don't suffer from insanity; I enjoy every minute of it!"