I have a table with columns:
- f_name - Varchar
- f_content - CLOB
table1
f_name f_content
test1.txt YL*1**50*1~
RX*1~
LR*2~
test2.txt YL*1**49*1~
EE*1~
WW*2~
f_content is more than 4000 characters and sometimes over 10000 characters.
Is it possible to create 3 Varchar2 columns and split max of 4000 characters in each column till the most recent ~ so the entire CLOB is covered?
The output would be:
f_name f_content f_content_varchar1 f_content_varchar2 f_content_varchar3
test1.txt YL*1**50*1~ YL*1**50*1~ RX*1~ LR*2~
RX*1~
LR*2~
test2.txt YL*1**49*1~ YL*1**49*1~ EE*1~ WW*2~
EE*1~
WW*2~
Please NOTE - I want to split it into 3 columns BUT ONLY ending till last ~, so for example if a line ends ~ on character 4003, then it should not add the last line to varchar column and always consider the prior line ending with ~.
An example would be:
YL*1**50*1~
RX*1~
LR*2~
Let's say 4000 characters end on
"YL*1**50*1~
RX*1~
LR"
then in varchar column1, it should store:
"YL*1**50*1~
RX*1~"
and in varchar column2, it should store:
"LR*2~"