Subject RE: [firebird-support] Sql
Author Nigel Weeks
Probably the easiest (I can think of) is to use a stored procedure.
Note - this will traverse the entire recordset, so it could be slow...)

set term !! ;
CREATE PROCEDURE fdet_summary
RETURNS (
RNO INTEGER,
EPOCH INTEGER,
MSE DECIMAL(18,10),
TRAINTIME TIMESTAMP
)
AS
declare variable int_counter integer
BEGIN
int_counter = 0;
FOR SELECT rno, epoch, mse, traintime FROM fdet
INTO :rno, :epoch, :mse, :traintime
DO
BEGIN
if(int_counter >= 1000)THEN
BEGIN
SUSPEND;
int_counter = 0;
END
ELSE
BEGIN
int_counter = :int_counter + 1;
END
END
END !!
set term ; !!


I think that'll work...

> -----Original Message-----
> From: nxciro [mailto:pict100@...]
> Sent: Thursday, 23 December 2004 3:58 PM
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] Sql
>
>
>
>
> Hello
>
> Fb 1.5.1
>
> I have a table currently loaded
> with 300,000 rows .
>
> //here is the meta
>
> CREATE TABLE FDET (
> RNO INTEGER
> , EPOCH INTEGER
> , MSE DECIMAL ( 18, 10 )
> , TRAINTIME TIMESTAMP
> )
>
> I would like to have a query which returns
> every 1000 row , so the resultset would have
> 300 records.
>
> The table is sorted on rno desc .
>
> How would the sql look like ?
>
> Thanks
> nxciro
>
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
> Now with Pop-Up Blocker. Get it for free!
> http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/67folB/TM
> --------------------------------------------------------------
> ------~->
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
> __________ NOD32 1.957 (20041222) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.nod32.com
>
>