Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    51

    Unanswered: Need help replacing values

    Hi
    I have to replace the value in the column as following
    12#@1 121

    123# 123

    234%^ 234

    12@ 12
    i.e. anything except numbers should be deleted
    How can I do this?

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    You might try using regular expressions functions:
    Code:
    SQL> SELECT  regexp_replace ('12#@1','[[:punct:]]') FROM dual;
    
    REG
    ---
    121
    
    SQL> SELECT  regexp_replace ('234%^','[[:punct:]]') FROM dual;
    
    REG
    ---
    234
    
    SQL>

  3. #3
    Join Date
    Mar 2002
    Location
    Reading, UK
    Posts
    1,137
    You can also do it using the TRANSLATE() function though you will have to list all the characters you want to remove, it will however work on any version of Oracle unlike regexp functions which are 10g only.

    Alan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •