Parameter into the IN clause

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FCS
Posts: 176
Joined: Sat 23 Feb 2013 18:46

Parameter into the IN clause

Post by FCS » Tue 11 Feb 2014 16:31

Hello,

Is it possible to send a parameter into IN clause, for example:
SELECT * FROM TABLE WHERE id IN (:id);
where ParamByName(id) = '5,6,7,8';

Regards
Michal

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Parameter into the IN clause

Post by AlexP » Wed 12 Feb 2014 09:32

Hello,

You cannot use parameters in the IN operator. To implement such behavior, you can use macros:

Code: Select all

  UniQuery1.SQL.Text := 'select * from dept where deptno in (&macro1)';
  UniQuery1.MacroByName('macro1').Value := '10,20,30';
  UniQuery1.Open;

FCS
Posts: 176
Joined: Sat 23 Feb 2013 18:46

Re: Parameter into the IN clause

Post by FCS » Wed 12 Feb 2014 11:06

Thanks :)

Regards
Michal

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Parameter into the IN clause

Post by AlexP » Wed 12 Feb 2014 14:09

If you have any further questions, feel free to contact us.

Post Reply