Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

REGEXP - Need to get NULL values from CSV file

KumarnklSep 12 2018 — edited Sep 12 2018

HI ALL,

We need to retrieve the values from the CSV file

E.g MIch,Lname,"Cat,rat",XXX,,YYY

Able get all values with comma delimited using REGEXP_SUBSTR.

But in the output we are getting only not null records as below

Query:

select level,REGEXP_SUBSTR('MIch,Lname,"Cat,rat",XXX,,YYY', '("[^"]*"|[^,]+)', 1, level) split

from dual 

connect by level <= length (regexp_replace ('MIch,Lname,"Cat,rat",XXX,,YYY', '("[^"]*"|[^,]+)'))  + 1;

Now getting output as

MIch

Lname

"Cat,rat"

XXX

YYY

Excepted output

MIch

Lname

"Cat,rat",

XXX

null   --> Since not values need to show the records in correct position as in CSV file.

YYY

Please Some one assist us to get expected output

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2018
Added on Sep 12 2018
16 comments
3,497 views