根据字符数插入称呼

Insert salutation depending on the number of characters

如果称呼超过 15 个字符,则在字段中插入单词“嗨”

考虑过使用正则表达式函数,但不确定如何实现

当regexp_like(称呼,>'^[0-9]{15}$')然后'Hi'

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;