Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

ID: 15065, Using IN in Parameterized Query or Stored Proc

by Wayne Niddery Email: Anonymous

Download Details
FTP  download also available 0 bytes
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For InterBase, Version 4.0  to 5.6 13 downloads
Copyright: No significant restrictions

Size: 0 bytes
Updated on Tue, 18 Jul 2000 00:00:00 GMT
Originally uploaded on Tue, 18 Jul 2000 00:00:00 GMT
Many people have run into the problem of wanting to pass a set of values to a query or stored procedure to be used in an IN clause, for example:

select apptno from appointments
where status in (:statuses);

Where the parameter statuses may look something like:

Of course this will not work. However there is a simple solution: Use LIKE instead of IN and reverse the test:

select apptno from appointments
where :statuses like '%' || status || '%'

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC04