MySQL Forums
Forum List  »  Triggers

Trigger to replace string
Posted by: Adam Obuchowski
Date: February 24, 2011 09:48AM

Hello
I need a trigger that will work on update replacing certain string within column

lets say column tech_prefix has values like

SD:;ST:;DP:ttt;CP:0004321;SC;TP:ttt:
SD:;ST:;DP:ttt;TP:ttt;CP:000xxxx;SC:
SD:;ST:;DP:ttt;TP:ttt;CP:00055555;SC:

I need it to be
if tech_prefix like '%CP:000%' replace everything between CP: and ' with fixed string 48222111444

So trigger should make these values like

SD:;ST:;DP:ttt;CP:48222111444;SC;TP:ttt:
SD:;ST:;DP:ttt;TP:ttt;CP:48222111444;SC:
SD:;ST:;DP:ttt;TP:ttt;CP:48222111444;SC:

Any idea how to make it working ?

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger to replace string
6219
February 24, 2011 09:48AM
2192
February 24, 2011 10:08AM
2239
February 24, 2011 11:42AM
2389
February 25, 2011 06:19AM
1938
February 25, 2011 07:00AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.