Skip to Main Content
  • Questions
  • how to insert delimited list into table/cursor

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Ni3.

Asked: October 01, 2016 - 10:26 am UTC

Last updated: October 01, 2016 - 12:18 pm UTC

Version: 11.2

Viewed 1000+ times

You Asked

I have two strings-
S1:='ABC,PQR,XYZ,DEF,ZXI';
S2:='567,87766,98u7,6363';
I want to insert these strings into below table.
Create table test(S1 varchar2(10),S2 varchar2(10));
How can I do this?
Also please suggest How can I put this delimited list into cursor?

and Connor said...

Plenty of examples on this site and others on parsing a csv into rows, eg

https://asktom.oracle.com/pls/apex/f?p=100:11:::NO::P11_QUESTION_ID:9523779800346652855

https://christopherbeck.wordpress.com/2012/04/03/parsing-a-csv-file-in-plsql/

And once you have rows...the rest is trivial, because rows can be inserted, queried, etc etc.

Is this answer out of date? If it is, please let us know via a Comment