I have a requirement in which I am getting a string with comma separated values and I have to extract the values and process. I used the query below and everything was working fine but it failed for the scenario when i have all null values in that string separated by ,.
SELECT regexp_substr(i_child_sal_acc_det, '[^,]+', 1, LEVEL)
BULK COLLECT INTO v_sal_acc_det_list
FROM dual
CONNECT BY regexp_substr(i_child_sal_acc_det, '[^,]+', 1, LEVEL)
IS NOT NULL.
The above query returns 4 records for input 'A,B,C,D' but only 1 record for ',,,' and 2 records for input ',C,D,'.
What i want is to fetch the values between commas even if it is NULL, and they can pass at max 9 values in a string.
Can you please help.