Subject RE: RE: [firebird-support] Re: returning desired amount of results within a stored proc.
Author Martin Dew
Thanks Pavel. This leads me then back to my initial question as I need a
solution for older IB and FB



I currently have IB5.6, IB 6.2 and FB 1.5.2 at sites, I need a solution
to enable me to stop returning records after I have a designated amount,
this solution needs to work with all of the IB and FB versions I
currently use. Then only way I can think that will work with all is to
use a counter variable, and an amount of records variable. I cannot seem
to make it exit when I have got my recordsToGet amount.



Can anyone help with the correct syntax to exit and return the records
it has thus far processed for me ?



CREATE PROCEDURE SP_HISTORY_PRINT (

LOGURN INTEGER

) RETURNS (

URN INTEGER

) AS



declare variable recordsToGet integer;

declare variable nCount integer;



BEGIN



recordsToGet = 5;

nCount = 0;

FOR

SELECT

l.urn

FROM

log l

order by

l.urn descending

INTO

:urn

DO BEGIN

nCount = nCount + 1;

if (nCount = recordsToGet) then

EXIT;

SUSPEND;

END

END



T.I.A



________________________________

From: Pavel Menshchikov [mailto:mpn2001@...]
Sent: 21 February 2005 09:09
To: Martin Dew
Subject: Re: RE: [firebird-support] Re: returning desired amount of
results within a stored proc.



Hello Martin,

MD> Thanks for the prompt reply and help. Is select first x supported by
IB
MD> 5.6 IB 6.02 aswell ?
No.


HTH
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com





Yahoo! Groups Sponsor


<http://us.ard.yahoo.com/SIG=1291r1fv0/M=324658.6070095.7083352.3001176/
D=groups/S=1705115386:HM/EXP=1109063307/A=2343726/R=0/SIG=12icson84/*htt
p:/clk.atdmt.com/VON/go/yhxxxvon01900091von/direct/01/&time=110897690767
3933>
<http://us.ard.yahoo.com/SIG=1291r1fv0/M=324658.6070095.7083352.3001176/
D=groups/S=1705115386:HM/EXP=1109063307/A=2343726/R=1/SIG=12icson84/*htt
p:/clk.atdmt.com/VON/go/yhxxxvon01900091von/direct/01/&time=110897690767
3933>

Get unlimited calls to
<http://us.ard.yahoo.com/SIG=1291r1fv0/M=324658.6070095.7083352.3001176/
D=groups/S=1705115386:HM/EXP=1109063307/A=2343726/R=1/SIG=12icson84/*htt
p:/clk.atdmt.com/VON/go/yhxxxvon01900091von/direct/01/&time=110897690767
3933>

U.S./Canada
<http://us.ard.yahoo.com/SIG=1291r1fv0/M=324658.6070095.7083352.3001176/
D=groups/S=1705115386:HM/EXP=1109063307/A=2343726/R=1/SIG=12icson84/*htt
p:/clk.atdmt.com/VON/go/yhxxxvon01900091von/direct/01/&time=110897690767
3933>


<http://view.atdmt.com/VON/view/yhxxxvon01900091von/direct/01/&time=1108
976907673933>


<http://us.adserver.yahoo.com/l?M=324658.6070095.7083352.3001176/D=group
s/S=:HM/A=2343726/rand=518650362>



________________________________

Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe
>

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .



[Non-text portions of this message have been removed]