我有以下查询:
SELECT
(substr(REGEXP_SUBSTR(qot_sup_xpressfeed, ',[^,]+,'), 2, length(REGEXP_SUBSTR(qot_sup_xpressfeed, ',[^,]+,')) - 2)) ,
xex.xex_xexc_k,
FROM qot, sec, exc, ctr, xcx, xex, xexc, xcrr, crr
WHERE qot_source = 'X'
AND qot_id = 2029557521
AND nvl(qot_real_exc_id, qot_exc_id) = exc_id
AND exc_ctr_id = ctr_id
AND qot_sec_id = sec_id
AND nvl(qot_real_exc_id, qot_exc_id) = xex_exc_id(+)
AND qot_crr_id = xcx_crr_id(+)
AND xex_xexc_k = xexc_k(+)
AND xcx_xcrr_k = xcrr_k(+)
AND qot_crr_id = crr_id(+)
AND qot_status IN (1, 2)
AND (qot_sup_xpressfeed IS NULL OR to_number(substr(REGEXP_SUBSTR(qot_sup_xpressfeed, ',[^,]+,'), 2, length(REGEXP_SUBSTR(qot_sup_xpressfeed, ',[^,]+,')) - 2)) = xexc_k);
当我注释掉最后一个限制时AND (qot_sup_xpressfeed IS NULL OR to_number(substr(REGEXP_SUBSTR(qot_sup_xpressfeed, ',[^,]+,'), 2, length(REGEXP_SUBSTR(qot_sup_xpressfeed, ',[^,]+,')) - 2)) = xexc_k);
,我得到了结果:
1135 67
1135 111
1135 549
1135 246
1135 103
1135 564
1135 1135
1135 21
如您所见,我有一排:
1135 1135
但是当我添加最后一个限制时,我没有得到任何结果:
AND (qot_sup_xpressfeed IS NULL OR to_number(substr(REGEXP_SUBSTR(qot_sup_xpressfeed, ',[^,]+,'), 2, length(REGEXP_SUBSTR(qot_sup_xpressfeed, ',[^,]+,')) - 2)) = xexc_k);
我希望我会得到 1 个结果(提到的1135 1135
)。我究竟做错了什么?