I have a scenario of splitting a string field based on newline character chr(10) using pl sql function with a loop and append a tag to the splitted strings(even if there is a empty string in a line).
eg- 1chr(10) 2chr(10) chr(10) 3 should become <a>1</a><a>2</a><a></a><a>3</a>
I have achieved it using an sql query in the following manner
Select '<test>'
|| replace('1chr(10) 2chr(10) chr(10)3',chr(10),'</test>'||chr(10)||'<test>')
|| '</test>'
From your_table;
But I want to get it done using PLSQL function for future uses and if I want to add any other logics. How can I do it using a loop in a plsql function?