Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: replace text
Jeff Kish wrote:
> Greetings.
>
> I can't figure out how to use replace.. maybe I'm looking at it wrong.
>
> I need to replace all occurrences of 'abc1' with 'abc2' in columns fitting a
> where clause (like this I imagine for table 'myAttributes':
> replace ('abc1','abc2) in myAttributes where column1 = 'mycolumn1' and column2
> = 'mycolumn2')
>
> Can someone tell me the right way to do this?
>
> Thanks
> Jeff Kish
The syntax you need is
UPDATE <table_name>
SET <column_name> = REPLACE(<column_name>, 'str1', 'str2');
WHERE ...
Check out: http://www.psoug.org/reference/translate_replace.html
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Fri Mar 05 2004 - 17:08:05 CST