Re: rows in select
Posted in 1996
sinyem@pc.jaring.my wrote: :On Mon, 4 Nov 1996, manoj@future.dsc.dalsys.com (Manoj Shroff) wrote: :>Hi All, :> :> Is there any way to find out how many rows were selected :>in Informix v7 (online). :> :> :You means counting selected rows from a table ???? Try the following: :SELECT COUNT(*) INTO num_of_row FROM table_name As a general solution this will give you the wrong result. It presumes there where no inserts/deletes between the time of the original select and this count. If the original select includes a where clause updates may also easily influence the count (with the same where clause in the select and the above count). If you have to count the number of rows selected before you do anything else you may select into a temporary table and count that. Generally you should try to avoid the need to count in this way through your database design. It is not allways possible of course. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org