次のクエリがあります。
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
)。私は何を間違っていますか?