The CREATE OR the REPLACE PROCEDURE pro_testcom (P_String the IN VARCHAR2 , replace1 the IN VARCHAR2 , replace2 the IN VARCHAR2 )
the IS
P_STARTDue to NUMBER : = . 1 ; - from which the start position taken
p_subLength NUMBER : = . 1 ; - need to intercept long
p_string_length NUMBER : = length ( P_String); - obtaining a string length needs taken
p_new_string VARCHAR2 ( , 2014 ): = '';--存储拼接新的字符串
BEGIN
WHILE(p_start < p_string_length + 1) LOOP
p_subLength := INSTR(p_string, replace1, p_start);
IF p_subLength = 0 THEN
p_subLength := p_string_length + 1;
END IF ;
IF p_new_string IS NULL THEN
p_new_string := SUBSTR(p_string , p_start , p_subLength - p_start);
ELSE
p_new_string := P_new_string || replace2 || the SUBSTR (P_String, P_STARTDue to, p_subLength - P_STARTDue to);
the END the IF ;
P_STARTDue to: = p_subLength + . 1 ;
the END LOOP;
- a print result
the DBMS_OUTPUT.PUT_LINE ( ' character string is replaced after: ' || p_new_string);
the END pro_testcom;