binding an in list

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
costa
Posts: 30
Joined: Thu 27 Aug 2009 20:30

binding an in list

Post by costa » Sat 25 Jan 2014 01:39

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

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

Re: binding an in list

Post by AlexP » Mon 27 Jan 2014 09:51

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.

costa
Posts: 30
Joined: Thu 27 Aug 2009 20:30

Re: binding an in list

Post by costa » Wed 29 Jan 2014 20:54

For now, I implemented it by replacing the parameter placeholder (i.e. :list) with the list of ids using the delphi StringReplace.

Post Reply