当我试图打开页面时,我收到的错误是"返回:8011 - SQL语句太长"。我们有大约数百万行。
在页面上我们正在填充滚动,并且where语句的创建类似于
For &i = 1 To &rs.ActiveRowCount
&PARAM1 = &rs(&i).Record.SETID.Value;
&PARAM2 = &rs(&i).Record.VENDOR_ID.Value;
&strWhere = &strWhere | " OR ";
&strWhere = &strWhere | "(SETID = " | "'" |(&PARAM1) | "'" | " AND VENDOR_ID = " | "'" |(&PARAM2) | "'" | ")";
End-for;
进行滚动选择时是否有限制?
答案 0 :(得分:1)
解释起来有点棘手,因为您需要更改的不仅仅是代码片段。
修改你的代码,使其更像这样:
&strWhere = ", PS_SOME_RECORD b where b.keyfield_1 = :1 and b.keyfield_2 = :2 ";
&strWhere = &strWhere | "and b.setid = a.setid ";
&strWhere = &strWhere | "and b.vendorid = a.vendorid";
相同但不同:
&strWhere = " inner join PS_SOME_RECORD b on b.setid = a.setid and b.vendor_id = a.vendor_id ";
&strWhere = &strWhere | "and b.keyfield_1 = :1 and b.keyfield_2 = :2";
基本上:使用数据库而不是尝试构建1,000,000行SQL语句。
最终你想从数据库(假设VENDOR表)返回一些与之不同的东西:
select *
from ps_vendor a
inner join ps_your_rs_table b
on b.setid = a.setid
and b.vendor_id = a.vendor_id
where b.some_field = [your filter/predicates]
答案 1 :(得分:0)
这是由于在条件“ IN”中传递的值的长度。
由于传入IN(“”)的数据值超出了限制,因此会导致此错误。