Re: Restricting queries to a certain number of rows?
Posted in 1996
Spetc@aol.com wrote:
>
> }FOREACH cursor INTO something.*
> } LET counter = counter + 1
> } IF counter >= 100 THEN
> } EXIT FOREACH
> } END IF
> }END FOREACH
>
> Wouldn't this still take "ages", because of the fact that FOREACH would still
> open a cursor and select all the data (say 10,000 rows) ?
Well, lets look at it this way:
If Informix allowed the syntax to say:
SELECT *
FROM foo
WHERE foo.bar = retz
ORDER BY 2LIMIT 100 <- Limits the query to 100 responses.....
You would still have to do all the work being done by the
cursor. So it may take *ages* to still do the query.
I think that if we look back to the orginal posting, the point was
allowing limits in the SQL statement. So I need to only write a
simple query rather than a 4GL function/segment to get only 100 rows
back.
-Mikey