永洪社区

标题: SQL数据集中写参数后,设置筛选条件时报错! [打印本页]

作者: yhdata_292u1GuA    时间: 2022-11-9 20:37
标题: SQL数据集中写参数后,设置筛选条件时报错!

select '合同生成' t_type , sum(contract_generate_qty) as qty from JKS_OTC_ADS.ADS_ORDER_OVERVIEW_DI tt where 1 = 1 <v_region_name> and REGION_NAME in (?{v_region_name})</v_region_name> <v_date_start>and tt.work_date > ?{v_date_start}</v_date_start> <v_date_end>and tt.work_date < ?{v_date_end}</v_date_end> <v_customer_name>and tt.customer_name in (?{v_customer_name})</v_customer_name> <v_product_name>and tt.product_name in (?{v_product_name})</v_product_name> <v_contract_no>and tt.contract_no in (?{v_contract_no})</v_contract_no> <v_order_no>and tt.order_no in (?{v_order_no})</v_order_no> <v_time_type>and tt.time_type in (?{v_time_type})</v_time_type>

作者: yhdata_lyaa    时间: 2022-11-9 21:13
是在报告报的错吗
作者: yhdata_292u1GuA    时间: 2022-11-10 10:02
yhdata_lyaa 发表于 2022-11-9 21:13
是在报告报的错吗

是的,在制作报告的时候报错了
作者: yhdata_292u1GuA    时间: 2022-11-10 10:14
yhdata_lyaa 发表于 2022-11-9 21:13
是在报告报的错吗

方便留个电话吗?

作者: yhdata_yzm    时间: 2022-11-10 10:21
看ORA-01795中给出的内容是SQL语句的 expressions 中list接受的最大值是1000,查了下ORA-01795的说明,确定问题出在IN后括号里的主键值超过1000上。

解决思路大至有两种,一种是换用JOIN或者EXIST,另一种是仍然用IN,但是把条件分成多个少于1000的IN即:SELECT * FROM DUAL T WHERE T.DUMMY IN ('1', '2', '3',...,'1000') OR IN ('1001', '1002', ..., '2000') OR ...
————————————————
版权声明:本文为CSDN博主「caolipeng_918」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/caolipeng_918/article/details/18823533
作者: yhdata_292u1GuA    时间: 2022-11-10 10:42
现在最大list已达到3万,后期数据也是在一直在增加,无法拆成多个in条件。永洪支持使用Java或者Python代码对SQL进行动态拼接吗
作者: BoJie    时间: 2022-11-10 11:02
有个条件过滤值超过1000个了!  肯定设计有问题啊!   
作者: yhdata_292u1GuA    时间: 2022-11-10 11:04
BoJie 发表于 2022-11-10 11:02
有个条件过滤值超过1000个了!  肯定设计有问题啊!

千万级的数据量,过滤值超1000不很正常吗?
作者: BoJie    时间: 2022-11-10 11:19
yhdata_292u1GuA 发表于 2022-11-10 11:04
千万级的数据量,过滤值超1000不很正常吗?

谁家报表设计过滤值有超过1000的,出现这种问题肯定是设计不简洁!  繁琐冗长
作者: yhdata_292u1GuA    时间: 2022-11-10 11:26
BoJie 发表于 2022-11-10 11:19
谁家报表设计过滤值有超过1000的,出现这种问题肯定是设计不简洁!  繁琐冗长 ...

你是来解决问题的,还是来发表你的高见的!
作者: BoJie    时间: 2022-11-10 11:31
yhdata_292u1GuA 发表于 2022-11-10 11:26
你是来解决问题的,还是来发表你的高见的!

hahh
作者: BoJie    时间: 2022-11-10 11:36
yhdata_292u1GuA 发表于 2022-11-10 11:26
你是来解决问题的,还是来发表你的高见的!

你这个参数用的是列表参数组件???
作者: BoJie    时间: 2022-11-10 11:47
试试这个

(, 下载次数: 298)