🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.interbase.sql
3 messages
3 total messages Started by Isaac Sat, 14 Jun 2008 21:39
return only first row
#229
Author: Isaac
Date: Sat, 14 Jun 2008 21:39
5 lines
932 bytes
Hello ,
is there another way to return only the first row in a select statement 
other than using for select and suspend ?

Thanks
Re: return only first row
#230
Author: Wayne Niddery (TeamB)
Date: Sun, 15 Jun 2008 01:47
28 lines
1992 bytes
"Isaac" <no@no.com> wrote in message news:485439ea@newsgroups.borland.com...
> is there another way to return only the first row in a select statement 
> other than using for select and suspend ?


You can tell a select statement to only return 1 row (or any number you 
want):

select * from sometable
order by whatever
rows 1

But to make a stored procedure *selectable* you must call Suspend anyway. 
I.e. Suspend is what lets you do:

  select * from myprocedure

as though the procedure was a table.

So it's just as easy to continue using For Select, but use the Rows clause.

You could just select (without For) into your return variables, as long as 
you specify Rows 1, and not call Suspend, but then you properly need to 
"execute procedure myprocedure" instead of selecting from it.

-- 
Wayne Niddery - TeamB (www.teamb.com)
Winwright, Inc. (www.winwright.ca) 
Re: return only first row
#231
Author: Isaac
Date: Sun, 15 Jun 2008 12:26
25 lines
1755 bytes
Wayne Niddery (TeamB) wrote:
>
> You can tell a select statement to only return 1 row (or any number 
> you want):
>
> select * from sometable
> order by whatever
> rows 1
>
> But to make a stored procedure *selectable* you must call Suspend 
> anyway. I.e. Suspend is what lets you do:
>
>  select * from myprocedure
>
> as though the procedure was a table.
>
> So it's just as easy to continue using For Select, but use the Rows 
> clause.
>
> You could just select (without For) into your return variables, as 
> long as you specify Rows 1, and not call Suspend, but then you 
> properly need to "execute procedure myprocedure" instead of selecting 
> from it.
>
yes I am not selecting from it any way, *Many Thanks*
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads