In my project i use oracle as primary database and i’ve faced a problem with parsing clob. So suppose we have a clob with value
aaaaaa
cccccc
bbbbbb
And it’s stored in table test …
I need to write plsql procedure to get this clob and split it so that i will have array with three items [aaaaaa,cccccccc,bbbbbbb].
Is there any possible solutions?
Here is a piece of code that works.
I suggest that you use explicit cursors instead of implicit ones (FOR i IN (select…)), for performance purpose.
First here is the script to create testcase.
Then here is the script to read line by line Clob :
‘amount’ variable is used to detect end of line position. Be carfull, in some case the end of line is CHR(10)||CHR(13) (CR + LF), and in some other cases it is only CHR(10).