Page 1 of 1

Parameter into the IN clause

Posted: Tue 11 Feb 2014 16:31
by FCS
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

Re: Parameter into the IN clause

Posted: Wed 12 Feb 2014 09:32
by AlexP
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;

Re: Parameter into the IN clause

Posted: Wed 12 Feb 2014 11:06
by FCS
Thanks :)

Regards
Michal

Re: Parameter into the IN clause

Posted: Wed 12 Feb 2014 14:09
by AlexP
If you have any further questions, feel free to contact us.