1. 程式人生 > 資料庫 >mysql的replace函式

mysql的replace函式

 

將單引號與雙引號的替換,有時候在json處理中需要:

 

dba@xxx ((none)) > select replace('xxxx"12345"677777','\"',"'");
+---------------------------------------+
| replace('xxxx"12345"677777','\"',"'") |
+---------------------------------------+
| xxxx'12345'677777                     |
+---------------------------------------+
1 row in set (0.07 sec)

Thu Nov 12 17:14:03 2020
dba@xxx ((none)) > select replace("xxxx'12345'677777","'",'\"');
+---------------------------------------+
| replace("xxxx'12345'677777","'",'\"') |
+---------------------------------------+
| xxxx"12345"677777                     |
+---------------------------------------+
1 row in set (0.07 sec)

Thu Nov 12 17:15:44 2020

 

 

 

 

 

 

 

 

 

 

 

###################################