Hi All,
In order to overcome this I have created a procedure in my database to replace a particular string with another.
REPLACE PROCEDURE REPLACE (IN in_source_str VARCHAR(4000), IN in_search_str VARCHAR(1000), IN in_replace_str VARCHAR(1000), OUT out_target_str VARCHAR(4000) )
BEGIN
DECLARE lv_flag CHAR(1) DEFAULT 'Y';
DECLARE lv_process_str VARCHAR(4000);
SET lv_process_str = in_source_str;
WHILE lv_flag='Y' DO
SET lv_process_str = SUBSTRING(lv_process_str FROM 1 FOR POSITION(in_search_str IN lv_process_str)-1 ) ||in_replace_str||SUBSTRING(lv_process_str FROM POSITION(in_search_str IN lv_process_str)+1 FOR CHARACTER_LENGTH(lv_process_str)-1);
IF POSITION(in_search_str IN lv_process_str) = 0 THEN
SET lv_flag='N';
END IF;
SET out_target_str = lv_process_str;
END WHILE;
SET out_target_str = lv_process_str;
END;
Hope this might be useful.
Hi All,
In order to overcome this I have created a procedure in my database to replace a particular string with another.
REPLACE PROCEDURE REPLACE (IN in_source_str VARCHAR(4000), IN in_search_str VARCHAR(1000), IN in_replace_str VARCHAR(1000), OUT out_target_str VARCHAR(4000) )
BEGIN
DECLARE lv_flag CHAR(1) DEFAULT 'Y';
DECLARE lv_process_str VARCHAR(4000);
SET lv_process_str = in_source_str;
WHILE lv_flag='Y' DO
SET lv_process_str = SUBSTRING(lv_process_str FROM 1 FOR POSITION(in_search_str IN lv_process_str)-1 ) ||in_replace_str||SUBSTRING(lv_process_str FROM POSITION(in_search_str IN lv_process_str)+1 FOR CHARACTER_LENGTH(lv_process_str)-1);
IF POSITION(in_search_str IN lv_process_str) = 0 THEN
SET lv_flag='N';
END IF;
SET out_target_str = lv_process_str;
END WHILE;
SET out_target_str = lv_process_str;
END;
Hope this might be useful.