1.TRANSLATE这个函数的格式:TRANSLATE ( '原本的值','需要被替换的值','替换后的值') 2.便于理解的例子: 例子A(‘原本的值’中如果有值不存在于‘需要被替换的值’,不存在于‘替换后的值’)的查询效果: 1 SELECTTRANSLATE ('ABCDEFGH','ABCDEFG','1234567')ASNEW_STRFROMDUAL;
TRANSLATE(x,from_string,to_string)函数在x中查找from_string中的字符,并将其转换成to_string中对应的字符。 执行如下: store@PDB1> select translate('secret message: meetme in the park','abcdefghijklmnopqrstuvwxyz','efghijklmnopqrstuvwxyzabcd') fromdual; TRANSLATE('SECRETMESSAGE:MEETMEINTH --- wi...
用法:将char中的字符串search_string全部转换为字符串replacement_string。 举例:SQL> select REPLACE('fgsgswsgs', 'fk' ,'j') 返回值 from dual; 返回值 --- fgsgswsgs SQL> select REPLACE('fgsgswsgs', 'sg' ,'eeerrrttt') 返回值 from dual; 返回值 --- fgeeerrrtttsweeerrrttts 分析:第一...
Oracle/ Oracle Database/ Release 23 SQL言語リファレンス 構文 図translate.epsの説明 目的 TRANSLATEは、from_string内のすべての文字をto_string内の対応する文字に置換してexprを戻します。from_string内に存在しないexpr内の文字は置換されません。引数from_stringには、to_stringより多い文字を指定で...
; 8 / TOBeOrnOttOBe PL/SQL procedure successfully completed. SQL> If you have more characters in the source string than in the replacement string, those characters are removed. No spaces appear in the result. With the TRANSLATE function, the third parameter, the replacement characters, can...
正斜杠(/):在Oracle中,用来终止SQL语句。更准确的说,是表示了“运行现在位于缓冲区的SQL代码”。正斜杠也用作分隔项。 例如:执行以下语句 CREATE TABLE TEMP (AAA VARCHAR2(2 BYTE), BBB VARCHAR2(2 BYTE) ) Insert into TEMP (AAA,BBB) values ('TESTA','TESTB'); ...
This Oracle tutorial explains how to use the Oracle / PLSQL TRANSLATE function with syntax and examples. The Oracle / PLSQL TRANSLATE function replaces a sequence of characters in a string with another set of characters.
to_stringにはアンダースコアを2つのみ含めていますが、このように指定するとfrom_stringの3番目の文字に対応する置換文字がない状態となり、戻り値にはアポストロフィが含まれないことになります。 SHOW TRANSLATE ('SQL*Plus User\'s Guide' '* \'' '__') SQL_Plus_Users_Guide...
Oraclesubstr/instr/translate函数使用介绍 substr函数: Sql代码 substr('Thisisatest',6,2)wouldreturn'is' substr('Thisisatest',6)wouldreturn'isatest' substr('TechOnTheNet',1,4)wouldreturn'Tech' substr('TechOnTheN坷柿蹲熟见寨烃洛东沽垒阴蘑铡庭踩健篱抚队娩唇颈逗阐肉窖冲妈询舌彻友雁轻莫这...
Oracle提供了一个字符替换函数translate,不同于replace函数的是,translate函数是字符级别的替换,而不是字符串的替换。 其语法如下: TRANSLATE ( expr , from_string , to_string ) 简单的说就是对expr内容,用to_string中的字符逐一替换from_string 中的字符,举例说明如下: ...