🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Passing Result Set as Parameter

#387
From: Ed Salgado
Date: Fri, 09 May 2008 16:21
36 lines
1792 bytes
All,

  Let's say I have a very simple stored procedure:

  CREATE PROCEDURE UpdateByParentID (
    AValue integer,
    AParentID integer)
  AS BEGIN
    UPDATE SomeTable SET SomeColumn = :AValue WHERE ParentID = :AParentID;
  END;

...and I want to call it with a number of ParentIDs derived from a result 
set.  Something like:

  EXECUTE PROCEDURE
    UpdateByParentID (1, 'SELECT ParentID FROM SomeOtherTable WHERE 
SomeOtherID BETWEEN 1 AND 10')

or

  EXECUTE PROCEDURE
    UpdateByParentID (1, 'SELECT ParentID FROM SomeOtherTable WHERE 
SomeOtherCost BETWEEN 50 AND 200')

or...

  Well, you get the idea.  The query that generates the list of ParentIDs, 
can be as simple or complicated as I would like.  Is there a way to pass a 
result set as a parameter? There may be hundreds or thousands of ParentIDs 
that need to be passed.

  Any help would be appreciated.

Thanks!

-ed 
Technical Details
Message-ID: <48247ad1$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,16fac8a9065fc51b,start
X-Google-Attributes: gid114a0e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Ed Salgado" <ed@onedomain.com>
From: "Ed Salgado" <ed@onedomain.com>
Newsgroups: borland.public.interbase.sql
Subject: Passing Result Set as Parameter
Date: Fri, 9 May 2008 11:21:14 -0500
Lines: 38
Organization: OneDomain, Inc.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 74.240.79.74
Message-ID: <48247ad1$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1210350289 74.240.79.74 (9 May 2008 09:24:49 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mail