【发布时间】:2011-09-08 14:54:05
【问题描述】:
我们的 Informix ESQL/C (.ec) 程序使用查询:
select count(*) from <table> where col >= val1 and col <= val2
在我们使用的程序内部:
select count(*) from <table> where col >= ? and col <= ?
现在,新要求是我们需要根据值列表进行搜索。该列表是动态生成的,我们不确定列表的大小。如果列表包含 2 列,则查询将类似于:
select count(*) from <table> where ((col >= ? and col <= ?) OR (col >= ? and col <= ?))
我们能够构建查询,但我们不确定如何执行。
当前执行如下:
exec sql execute :select_prepare using :val1, :val2
我们有一个整数数组中的所有值。由于我们不确定参数的数量,所以我们在准备执行语句时陷入了困境。
下面的命令不起作用
exec sql execute :select_prepare using :val_array
谁能为此提供任何解决方案?
【问题讨论】: