🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #230

Re: return only first row

#230
From: 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) 
Technical Details
Message-ID: <485474b1$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <485439ea@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,28a1978876c492d6
X-Google-Attributes: gid114a0e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Wayne Niddery \(TeamB\)" <wniddery@chaffaci.on.ca>
Newsgroups: borland.public.interbase.sql
References: <485439ea@newsgroups.borland.com>
In-Reply-To: <485439ea@newsgroups.borland.com>
Subject: Re: return only first row
Date: Sat, 14 Jun 2008 21:47:20 -0400
Lines: 29
MIME-Version: 1.0
Content-Type: text/plain;
 format=flowed;
 charset="iso-8859-1";
 reply-type=response
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6001.18000
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18000
NNTP-Posting-Host: 24.137.214.213
Message-ID: <485474b1$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1213494449 24.137.214.213 (14 Jun 2008 18:47:29 -0700)
X-Authenticated-User: wniddery
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail