Subject Re: [firebird-support] store procedure WHERE IN
Author Martijn Tonies
Hi,

> Is there a way to pass in a parameter for a WHERE IN caluse to a
> stored proc?
>
> something like this but not this
>
> create procedure testproc
> (listOfValues ?????datatype????)
> returns (id integer)
> as
> begin
> for select id from mytable where blah IN (:listOfValues)
> do
> suspend;
> end
>
> any idea how this kind of thing could be done?

Well, not like that. "listofvalues" should be separate strings, which,
as a parameter, it isn't.

With Firebird 1.5, the thing you CAN do, however, is something like
this:

create procedure testproc
(listOfValues varchar(200) )
returns (id integer)
as
begin
for execute statement 'select id from mytable where blah in (' ||
listofvalues || ') '
do suspend;
end

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com