[fpc-pascal] Sqldb - How to pass an array of values as a param to be used with SQL IN operator?

Luiz Americo Pereira Camara luizamericop at gmail.com
Sun Apr 10 13:27:37 CEST 2016


I switched most of my SQL queries to use Params instead of formatting
directly the SQL.

But until now i havent figured a way to pass an array of values (mostly
integers) to be used with IN operators.

Example:

SQL: Select  * from Customer where Id in (:idlist)

I need to query customers with Ids 1, 2 and 3

If i do

ParamByName('idlist').AsString := '1,2,3';

will not work.

Is there a way to accomplish this?

Luiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160410/9c09c074/attachment.html>


More information about the fpc-pascal mailing list