Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2012-03-07T12:25:20Z by SystemAdmin
LKMA
LKMA
3 Posts
ACCEPTED ANSWER

Pinned topic 'Replace' syntax

‏2012-03-07T07:53:00Z |
What is the proper syntax for replacing characters?
My replace statement:

Select replace(note,’old’,’new’) from history

So I am trying to update instances of 'old' to 'new' in the note column of the history table.

The result: The updated text is displayed as I would it expect but the change is not committed so the actual update doesn't happen.
Updated on 2012-03-07T12:25:20Z at 2012-03-07T12:25:20Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1143 Posts
    ACCEPTED ANSWER

    Re: 'Replace' syntax

    ‏2012-03-07T12:25:20Z  in response to LKMA
    If you want to update column, you should use UPDATE statement IMHO.
    e.g.
    UPDATE history SET note=replace(note,’old’,’new’)
    -- WHERE ....if you do not want to update all fields put restriction here
    ;
    HTH
    Hrvoje