<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Oracle - replace . with - in column in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867012#M863733</link>
    <description>hi,&lt;BR /&gt;&lt;BR /&gt;use of "replace" and "translate" will be a better option.&lt;BR /&gt;&lt;BR /&gt;Below a more complex example:&lt;BR /&gt;yd@MYDB.MU&amp;gt; variable undesirable varchar2(255)&lt;BR /&gt;yd@MYDB.MU&amp;gt; exec :undesirable := 'SAT'&lt;BR /&gt;&lt;BR /&gt;PL/SQL procedure successfully completed.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:05.60&lt;BR /&gt;yd@MYDB.MU&amp;gt; select username,&lt;BR /&gt;replace(&lt;BR /&gt;translate( username, :undesirable, substr(:undesirable,1,1) ),&lt;BR /&gt;substr(:undesirable,1,1), '' )&lt;BR /&gt;from all_users&lt;BR /&gt;where rownum &amp;lt; 5&lt;BR /&gt;/  &lt;BR /&gt;&lt;BR /&gt;USERNAME                       REPLACE(TRANSLATE(USERNAME,:UN&lt;BR /&gt;______________________________ ______________________________&lt;BR /&gt;SYS                            Y&lt;BR /&gt;SYSTEM                         YEM&lt;BR /&gt;OUTLN                          OULN&lt;BR /&gt;OPS$SWS                        OP$W&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.01&lt;BR /&gt;yd@MYDB.MU&amp;gt;&lt;BR /&gt;&lt;BR /&gt;hopw this helps!&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Yogeeraj</description>
    <pubDate>Sun, 24 Oct 2004 22:59:53 GMT</pubDate>
    <dc:creator>Yogeeraj_1</dc:creator>
    <dc:date>2004-10-24T22:59:53Z</dc:date>
    <item>
      <title>Oracle - replace . with - in column</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867009#M863730</link>
      <description>I need to update a table that in a column that anything that has a . (period) replace with - (dash)&lt;BR /&gt;&lt;BR /&gt;What would be to proper sql syntax?&lt;BR /&gt;&lt;BR /&gt;Update line_table &lt;BR /&gt;where line like '%.%'&lt;BR /&gt;???&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Have no idea?&lt;BR /&gt;Thanks for the help.</description>
      <pubDate>Sun, 24 Oct 2004 18:51:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867009#M863730</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2004-10-24T18:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle - replace . with - in column</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867010#M863731</link>
      <description>Hi,&lt;BR /&gt;To use special characters for column values you use the escape character. By default escape character is '\' ot you can define you own escape character.&lt;BR /&gt;&lt;BR /&gt;To use the default escape character do this&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;set escape on&lt;BR /&gt;&lt;BR /&gt;sql&amp;gt;update table_name&lt;BR /&gt;    set column = '%\-% '&lt;BR /&gt;    where column like '%\.%';&lt;BR /&gt;&lt;BR /&gt;Here is an example I tested&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select * from tab1;&lt;BR /&gt;&lt;BR /&gt;NAME&lt;BR /&gt;----------&lt;BR /&gt;aaa.bbb&lt;BR /&gt;ccc.ddd&lt;BR /&gt;ttt.sss&lt;BR /&gt;SQL&amp;gt; update indira&lt;BR /&gt;    set name = 'yyy\-nnn'&lt;BR /&gt;    where name like '%\.%';&lt;BR /&gt;&lt;BR /&gt;3 rows updated.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select * from indira;&lt;BR /&gt;&lt;BR /&gt;NAME&lt;BR /&gt;----------&lt;BR /&gt;yyy-nnn&lt;BR /&gt;yyy-nnn&lt;BR /&gt;yyy-nnn&lt;BR /&gt;&lt;BR /&gt;Note: That you can do this if all the column values are same with a '-'.&lt;BR /&gt;&lt;BR /&gt;The other way is you can you your own special by &lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;SQL&amp;gt; set escape '~' &lt;BR /&gt;Here '~' is you escape chanracter, so replace the '\' with '~'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Indira A &lt;BR /&gt;</description>
      <pubDate>Sun, 24 Oct 2004 20:00:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867010#M863731</guid>
      <dc:creator>Indira Aramandla</dc:creator>
      <dc:date>2004-10-24T20:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle - replace . with - in column</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867011#M863732</link>
      <description>Hmmm, . and - are not special characters in string constants I believe. And, the prior&lt;BR /&gt;example will replace each match with the same value for each row no?&lt;BR /&gt; &lt;BR /&gt;I kinda suspect that the real problem was to replace just the dot with a dash and leave the reast of the colum as it was.&lt;BR /&gt;&lt;BR /&gt;You'll need to sql/sqlplus string manipulation magic to make that happen.&lt;BR /&gt;Check out the 'string' functions in the SQL ref man, notably 'TRANSLATE' this time. But INSTR and SUBSTR are often useful.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h10025.www1.hp.com/ewfrf/wc/genericDocument?lc=en&amp;amp;cc=us&amp;amp;docname=c00223200" target="_blank"&gt;http://h10025.www1.hp.com/ewfrf/wc/genericDocument?lc=en&amp;amp;cc=us&amp;amp;docname=c00223200&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Check this out:&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; create table hein (test varchar(10));&lt;BR /&gt;SQL&amp;gt; insert into hein values ('aap.noot');&lt;BR /&gt;SQL&amp;gt; insert into hein values ('noot mies');&lt;BR /&gt;SQL&amp;gt; insert into hein values ('mies.teun');&lt;BR /&gt;SQL&amp;gt; select * from hein ;&lt;BR /&gt;&lt;BR /&gt;TEST&lt;BR /&gt;----------&lt;BR /&gt;aap.noot&lt;BR /&gt;noot mies&lt;BR /&gt;mies.teun&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; update hein set test=translate(test,'.','-') where test like '%.%';&lt;BR /&gt;&lt;BR /&gt;2 rows updated.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select * from hein ;&lt;BR /&gt;&lt;BR /&gt;TEST&lt;BR /&gt;----------&lt;BR /&gt;aap-noot&lt;BR /&gt;noot mies&lt;BR /&gt;mies-teun&lt;BR /&gt;&lt;BR /&gt;Of course the 'where like' clause for this example is kinda redundant in the sense that the same table results, because only dots will be replace. With the 'where', fewer updates are done.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 24 Oct 2004 20:30:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867011#M863732</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-10-24T20:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle - replace . with - in column</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867012#M863733</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;use of "replace" and "translate" will be a better option.&lt;BR /&gt;&lt;BR /&gt;Below a more complex example:&lt;BR /&gt;yd@MYDB.MU&amp;gt; variable undesirable varchar2(255)&lt;BR /&gt;yd@MYDB.MU&amp;gt; exec :undesirable := 'SAT'&lt;BR /&gt;&lt;BR /&gt;PL/SQL procedure successfully completed.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:05.60&lt;BR /&gt;yd@MYDB.MU&amp;gt; select username,&lt;BR /&gt;replace(&lt;BR /&gt;translate( username, :undesirable, substr(:undesirable,1,1) ),&lt;BR /&gt;substr(:undesirable,1,1), '' )&lt;BR /&gt;from all_users&lt;BR /&gt;where rownum &amp;lt; 5&lt;BR /&gt;/  &lt;BR /&gt;&lt;BR /&gt;USERNAME                       REPLACE(TRANSLATE(USERNAME,:UN&lt;BR /&gt;______________________________ ______________________________&lt;BR /&gt;SYS                            Y&lt;BR /&gt;SYSTEM                         YEM&lt;BR /&gt;OUTLN                          OULN&lt;BR /&gt;OPS$SWS                        OP$W&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.01&lt;BR /&gt;yd@MYDB.MU&amp;gt;&lt;BR /&gt;&lt;BR /&gt;hopw this helps!&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Yogeeraj</description>
      <pubDate>Sun, 24 Oct 2004 22:59:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867012#M863733</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2004-10-24T22:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle - replace . with - in column</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867013#M863734</link>
      <description>Thank you!</description>
      <pubDate>Mon, 25 Oct 2004 16:34:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-replace-with-in-column/m-p/4867013#M863734</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2004-10-25T16:34:17Z</dc:date>
    </item>
  </channel>
</rss>

