Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Quang Ton-That asked how to limit the rows returned by a select, in SQL or ESQL/C. Andy Lennard and Andy Grantham pointed to SELECT FIRST n, available from 7.30. Art S. Kagel confirmed that for 7.3x, and for older versions suggested closing the cursor after fetching enough rows, since the server only fills one transfer buffer. Solved.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Quang Ton-That — — source: Informix-list mailing list archive (1991-1998)
Does anyone know how to set the limit on the number of rows in a simple
(Informix) SQL select statement or by Informix ESQL/C API?
Thanks,
Quang
↪ replying to Quang Ton-That
Andy Lennard — — source: Informix-list mailing list archive (1991-1998)
try 'select first n from table...'
according to release notes available from 7.30
In article <7r4di5$ogq1@newsflash.tibco.com>, Quang Ton-That <quang.tont
hat@tibcofinance.com> writes
>Does anyone know how to set the limit on the number of rows in a simple
>(Informix) SQL select statement or by Informix ESQL/C API?
>
>Thanks,
>Quang
>
>
Andrew Lennard andy@kontron.demon.co.uk
Hello Quang.
In 7.30 you can use SELECT FIRST to limit the number of rows returned.
Otherwise you could use a CURSOR and manually count the number of rows
either in an ESQL program or by using a Stored Proc.
Regards
Andy Grantham
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
↪ replying to Quang Ton-That
Art S. Kagel — — source: Informix-list mailing list archive (1991-1998)
If you have 7.3x use:
SELECT FIRST 43 .......
Since you are using ESQL/C you can always just close the cursor after
fetching the number of rows you want to fetch. The engine will only fill
the next communication transfer buffer (default size is 4K configured by
the global FetBufSize before the first OPEN statement in your program,
range 4K->(32K-1)) anyway so there will not be a huge amount of extra work
done on the server so this will work reasonably well on 7.[12]x.
Art S. Kagel
Quang Ton-That wrote:
>
> Does anyone know how to set the limit on the number of rows in a simple
> (Informix) SQL select statement or by Informix ESQL/C API?
>
> Thanks,
> Quang
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.