Page 1 of 1

binding an in list

Posted: Sat 25 Jan 2014 01:39
by costa
Hello:

Is it possible to bind an in list?

Example:

select *
from table t
where t.id in (:idslist)

If yes, what would be the type of the parameter and what kind of value should I associate with it?

Thanks

Re: binding an in list

Posted: Mon 27 Jan 2014 09:51
by AlexP
Hello,

You cannot use the IN function with parameters. Instead, you can use, for example, the INSTR function:

Code: Select all

select * from dept
where INSTR( :p1, '_'||TO_CHAR(deptno)||'_') > 0
where parameter is set as

Code: Select all

OraQuery1.ParamByName('p1').AsString := '_10_20_30_';
The "_" symbol can be replaced with any other symbol.

Re: binding an in list

Posted: Wed 29 Jan 2014 20:54
by costa
For now, I implemented it by replacing the parameter placeholder (i.e. :list) with the list of ids using the delphi StringReplace.