PostgreSQL字符串截取替換

初始化數據庫數據庫


CREATE TABLE public.t1ide

(spa

  name textorm

)string


 nameit

-------io

"David"class

"Peter"date

"任務2016-09-10 10:09:00"select

"任務2016-10-10 12:03:00"

"任務2016-12-22 14:10:00"


把包含"任務"的記錄替換爲"Job"


update t1 set name= 'Job'||substring(name,3) where substring(name,position('任務' in name),2)='任務'; 


select * from t1;

 name

-------

"David"

"Peter"

"Job2016-09-10 10:09:00"

"Job2016-10-10 12:03:00"

"Job2016-12-22 14:10:00"

相關文章
相關標籤/搜索