PostgreSQL更新字符串,在前后添加字符

时间:2018-06-25 14:08:32

标签: sql postgresql

帮助请用以下数据更新card_num列:

"000001"
"000002"
..
"000200"

需要这样做:

"%000001,"
"%000002,"
..
"%000200,"

1 个答案:

答案 0 :(得分:1)

update table set card_num = '%'||card_num||','

使用|| concatenation运算符将nulls保留为nulls而不是%,