I have a column in my oracle database which due reasons beyond my control contains a CSV string e.g.
Item a,Item b,Item c,Item d
I want to run an UPDATE statement to get rid of item c. Thus ending up with
Item a,Item b,Item d
How can I achieve this
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use the Oracle REPLACE function:
You just need to be careful handling it as part of a CSV, e.g stripping a following comma. This could mean replacing ‘item c,’ first and then replacing ‘item c’ to capture both cases.
EDIT: ah, I might have misunderstood. My solution is based on removing a particular string from your CSV – if you are looking to always replace the 3rd item then Vincent’s answer is the one you’ll need