如何替换 oracle 语句中的多个单词/特殊字符



I have statement(我有语句

(
"Mumbai & Pune are big cities in Maharashtra. Mumbai > Pune."

我需要一个查询来替换:"&"作为'AND'">"在 Oracle 中的单个查询中'GREATER THAN'

所需输出为

Mumbai AND Pune are big cities in Maharashtra. Mumbai GREATER THAN Pune.

尝试替换

Select replace(replace(your_string,'&',' AND '),'>',' GREATER THAN ') FROM TABLE

干杯!!

嵌套replace

SQL> with test (col) as
2    (select 'Mumbai & Pune are big cities in Maharashtra. Mumbai>Pune.' from dual)
3  select replace(replace(col, '&', 'AND'),
4                              '>', ' GREATER THAN ') result
5  from test;
RESULT
------------------------------------------------------------------------
Mumbai AND Pune are big cities in Maharashtra. Mumbai GREATER THAN Pune.
SQL>

最新更新