问题描述
这是我的代码,我必须将日期作为参数传递..查询在SQl工作台上正常工作。但在处理时产生参数索引超出范围错误
我尝试过:
选择'POLICY_NUMBER','POLICY_SUB_NUM','FLOOD_COVERAGE','FLOOD_COVERAGE_PREMIUM'\
UNION \
(SELECT POL_POLICY.POLICY_NUMBER,POL_POLICY.POLICY_SUB_NUM,POL_PL_POLICY_PLAN.FLOOD_COVERAGE,POL_PL_POLICY_PLAN.FLOOD_COVERAGE_PREMIUM from POL_POLICY \
INNER JOIN POL_POLICY_VER ON POL_POLICY .POL_POLICY_ID = POL_POLICY_VER.POL_POLICY_ID \
AND POL_POLICY.CURRENT_VER_ID = POL_POLICY_VER.POL_POLICY_VER_ID \
INNER JOIN POL_PL_POLICY_PLAN ON POL_POLICY_VER.POL_POLICY_ID = POL_PL_POLICY_PLAN.POL_POLICY_ID \
AND POL_POLICY_VER.POL_POLICY_VER_ID = POL_PL_POLICY_PLAN.POL_POLICY_VER_ID \
INNER JOIN POL_POLICY_PRODUCT ON POL_POLICY。 POL_POLICY_ID = POL_POLICY_PRODUCT.POL_POLICY_ID AND POL_POLICY.CURRENT_VER_ID = \ POL_POLICY_PRODUCT.POL_POLICY_VER_ID INNER JOIN PRD_PRODUCT ON POL_POLICY_PRODUCT.PRD_PRODUCT_ID = PRD_PRODUCT.PRD_PRODUCT_ID \
WHERE
POL_POLICY.POLICY_SUB_NUM = 0 \
AND \
PRD_PRODUCT.LOB ='个人行'和\
POL_POLICY.POLICY_TYPE<>'ENDORSEMENT'\\ \\
AND(POL_POLICY_VER.POLICY_STATUS in('ISSUED'))\
AND POL_POLICY_PRODUCT.PRD_PRODUCT_VER_ID in(3671,3672,3673,3674,3675,3677,3678 ,3676,4416,4417,4418,4419,4207,4208,4209,4210,4439,4440,4441,4442,\\ /
3940,3941,3942,3943,4339,4499,4341 ,4500,4478,4571,4668,3497,4572,4113,4114,4116,4117,4115,3538,3539,3540,3541,3542,3543,3544,3545,3584,4283,4284,\
4285,4286,4287,4370,4509,4521)\
和DATE(POL_POLICY.POLICY_EXP_DATE)BETWEEN?和? \
GROUP BY POL_POLICY.POLICY_NUMBER \
ORDER BY POL_POLICY.POL_POLICY_ID DESC)
This is my code , I have to pass date as parameters .. The query works fine on SQl workbench .but produces Parameter index out of range error while processing
What I have tried:
SELECT 'POLICY_NUMBER', 'POLICY_SUB_NUM', 'FLOOD_COVERAGE','FLOOD_COVERAGE_PREMIUM' \
UNION \
(SELECT POL_POLICY.POLICY_NUMBER, POL_POLICY.POLICY_SUB_NUM, POL_PL_POLICY_PLAN.FLOOD_COVERAGE,POL_PL_POLICY_PLAN.FLOOD_COVERAGE_PREMIUM FROM POL_POLICY \
INNER JOIN POL_POLICY_VER ON POL_POLICY.POL_POLICY_ID = POL_POLICY_VER.POL_POLICY_ID \
AND POL_POLICY.CURRENT_VER_ID = POL_POLICY_VER.POL_POLICY_VER_ID \
INNER JOIN POL_PL_POLICY_PLAN ON POL_POLICY_VER.POL_POLICY_ID = POL_PL_POLICY_PLAN.POL_POLICY_ID \
AND POL_POLICY_VER.POL_POLICY_VER_ID = POL_PL_POLICY_PLAN.POL_POLICY_VER_ID \
INNER JOIN POL_POLICY_PRODUCT ON POL_POLICY.POL_POLICY_ID = POL_POLICY_PRODUCT.POL_POLICY_ID AND POL_POLICY.CURRENT_VER_ID = \ POL_POLICY_PRODUCT.POL_POLICY_VER_ID INNER JOIN PRD_PRODUCT ON POL_POLICY_PRODUCT.PRD_PRODUCT_ID = PRD_PRODUCT.PRD_PRODUCT_ID \
WHERE
POL_POLICY.POLICY_SUB_NUM =0 \
AND \
PRD_PRODUCT.LOB='Personal Lines' AND \
POL_POLICY.POLICY_TYPE<>'ENDORSEMENT' \
AND (POL_POLICY_VER.POLICY_STATUS in ('ISSUED')) \
AND POL_POLICY_PRODUCT.PRD_PRODUCT_VER_ID in (3671,3672,3673,3674,3675,3677,3678,3676,4416,4417,4418,4419,4207,4208,4209,4210,4439,4440,4441,4442, \
3940,3941,3942,3943,4339,4499,4341,4500,4478,4571,4668,3497,4572,4113,4114,4116,4117,4115,3538,3539,3540,3541,3542,3543,3544,3545,3584,4283,4284, \
4285,4286,4287,4370,4509,4521) \
and DATE(POL_POLICY.POLICY_EXP_DATE) BETWEEN ? AND ? \
GROUP BY POL_POLICY.POLICY_NUMBER \
ORDER BY POL_POLICY.POL_POLICY_ID DESC)
这篇关于如何在选择查询中解决超出范围的参数索引(1>参数数量,即0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!