Replace a word in a fieldTo replace a word in the memo field, for example, replace "XXX payable" with "XXX pay-as-you-go". Other words remain unchanged. The traditional update statement is very troublesome to do this update. From 10 Gb, we can use regular expressions.
| SelectRegexp_replace (memo, 'Re', 'real ')FromTable_aWhereCode = '000000 ';UpdateTable_aSetMemo = regexp_replace (memo, 'response', 'real ')WhereA. Code = '20140901 '; |
Introduction to other regular functions: regexp_like: regular like
SELECT first_name, last_name FROM employees WHERE REGEXP_LIKE (first_name, '^Ste(v|ph)en FIRST_NAME LAST_NAME -------------------- ------------------------- Steven King Steven Markle Stephen Stiles |
Regexp_instr: determines the number of BITs that meet the regular expression condition: '100 Oracle Parkway, Redwood Shores, CA 'source string' [S | r | p] [[: Alpha:] {6} 'regular expression, starting with S | r | P and starting with 6 letters and 3. The default value is 12. Oracle search meets 2nd modes, the default value is 11 and the string following the matching mode is returned. The default value is 0 I, which is case insensitive.
SELECT REGEXP_INSTR('500 Oracle Parkway, Redwood Shores, CA', '[s|r|p][[:alpha:]]{6}', 3, 2, 1, 'i') "REGEXP_INSTR" FROM DUAL; REGEXP_INSTR ------------ 28 |
Regexp_substr
SELECT REGEXP_SUBSTR('http://www.oracle.com/products', 'http://([[:alnum:]]+/.?){3,4}/?') "REGEXP_SUBSTR" FROM DUAL; REGEXP_SUBSTR ---------------------- http://www.oracle.com/ |
Wonder
2008-03-20
);
___FCKpd___3
___FCKpd___4
___FCKpd___5
___FCKpd___6
___FCKpd___7
___FCKpd___8
Regexp_instr: determines the number of BITs that meet the regular expression condition: '100 Oracle Parkway, Redwood Shores, CA 'source string' [S | r | p] [[: Alpha:] {6} 'regular expression, starting with S | r | P and starting with 6 letters and 3. The default value is 12. Oracle search meets 2nd modes, the default value is 11 and the string following the matching mode is returned. The default value is 0 I, which is case insensitive.
___FCKpd___9 ___FCKpd___10 ___FCKpd___11 ___FCKpd___12 ___FCKpd___13 ___FCKpd___14 ___FCKpd___15 ___FCKpd___16 |
Regexp_substr
___FCKpd___17 ___FCKpd___18 ___FCKpd___19 ___FCKpd___20 ___FCKpd___21 ___FCKpd___22 ___FCKpd___23 ___FCKpd___24 |
Wonder
2008-03-20