开发者

Does Replace function in postgres have except cases

开发者 https://www.devze.com 2023-03-13 10:33 出处:网络
How can i use the repla开发者_StackOverflowce function with some except conditions.You can\'t. Try using a regular expression if you need more control over what is being replaced.

How can i use the repla开发者_StackOverflowce function with some except conditions.


You can't. Try using a regular expression if you need more control over what is being replaced.

regexp_replace(string text, pattern text, replacement text [,flags text])

If regex isn't enough then create your own function in PL/pgSQL


How can i use the replace function with some except conditions.

Such as? Of course, SpliFF is absolutely right, you can use regexp_replace, as that would give you more control over what is matched, but in case you're talking about another condition, can't you just use a where clause?

UPDATE foo SET bar = REPLACE( bar, 'foo', 'bar' ) WHERE yourcondition IS TRUE;
0

精彩评论

暂无评论...
验证码 换一张
取 消