I need to replace a string (maxextent 10K) with string (maxextent unlimited) using a PL/SQL program. I have to do it in multiple files and I am using a UTL_FILE package to open and write to the file. How can I search the string in a file and replace it.
I would do it like this (code not tested, just my "process"):
fhandle := fopen( my_file );
while not feof loop
temp_var := fread( fhandle);
huge_string_var := huge_string_var || temp_var;
pos_v := instr( huge_string_var, 'search_string' );
if pos_v > 0 then
-- I found the string, so do something
-- next line is to continue the search for more matches, but if not necessary just exit
huge_string_var := substr( huge_string_v, pos_v + length( 'search_string' );
Reason for doing it this way, is because you never know where the input string will be broken up on the FREAD. Happy to explain further if you need.