Subject | Re: [firebird-support] Is there a way to pass a result set as a parameter? |
---|---|
Author | Martijn Tonies |
Post date | 2008-05-09T16:47:02Z |
Hi,
pass a WHERE clause that can be used in FOR EXECUTE STATEMENT ...
Have a look at the Firebird 1.5 release notes for that.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
> Let's say I have a very simple stored procedure:No, you cannot use it as that. Pass each "ParentID" individually, or
> 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.
pass a WHERE clause that can be used in FOR EXECUTE STATEMENT ...
Have a look at the Firebird 1.5 release notes for that.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com