binding an in list

binding an in list

Postby 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
costa
 
Posts: 30
Joined: Thu 27 Aug 2009 20:30

Re: binding an in list

Postby 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.
AlexP
Devart Team
 
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: binding an in list

Postby 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.
costa
 
Posts: 30
Joined: Thu 27 Aug 2009 20:30


Return to dbExpress driver for Oracle