日期:2014-05-16 浏览次数:20439 次
select REGEXP_REPLACE( '00000921000001 ', '921', '924')? from dual; select REPLACE( '00000921000001 ', '921', '924')? from dual; select translate( '00000921000001 ', '921', '924')? from dual;
REPLACE?(?char,?search_string?[,?replace_string])
REGEXP_REPLACE(?source_string,?pattern ? [,?replace_string ? [,?position ? [,?occurrence ? [,?match_parameter?] ? ] ? ] ? ] ? )?
select?REGEXP_SUBSTR?(Phone, ? '([[:digit:]]{3})-([[:digit:]]{3})-([[:digit:]]{4})' ? )?"REGEXP_SUBSTR" ? from?ADDRESS; ? REGEXP_SUBST ? ------------ ? 213-555-0223 ? 415-555-7530?
TRANSLATE ( expr , from_string , to_string )
SQL> select translate('123456789','456','abc') from dual; TRANSLATE --------- 123abc789 SQL> select translate('123456789','456','ab') from dual; TRANSLAT -------- 123ab789 SQL> select translate('123456789','4564','a') from dual; TRANSLAT ------- 123a789 SQL> select translate('123456789','4564','abcd') from dual; TRANSLATE --------- 123abc789
select length(translate('expl','x'||'expl','x')) from dual结果为:1