在称呼大于15个字符的情况下,将在字段中插入“Hi”字样
考虑使用正则表达式函数,但不知道如何实现它
当regexp_like(称呼,>'^ [0-9] {15} $')然后'嗨'
MR Nigel Humphreys -> "hi"
Ms Montjoy -> "Ms Montjoy"
Mr Fitz-Lloyd Smith -> "hi"
length()
和case
怎么样?
select (case when length(salutation) > 15 then 'hi'
else salutation
end) as new_salutation
如果要实际覆盖该字段,则需要更新:
update t
set salutation = 'hi'
where length(salutation) > 15;