Remove non-alphanumeric

We are using Oracle 9i.
How can i remove non-alphanumeric characters [ie , . ; : ( ) / \ etc] from a varchar2 field
James

Or
michaels>  with t as
     (select     dbms_random.string ('p', 10) str
            from dual
      connect by level <= 10)
select str,
       translate
          (str,
           'X'
           || translate
                (str,
                 'X0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
                 'X'
           'X'
          ) without_special_characters
  from t
STR                            WITHOUT_SPECIAL_CHARACTERS   
CJy0*E[+}+                     CJy0E                        
."$2R="I`.                     2RI                          
WiMK%ALkNT                     WiMKALkNT                    
YDmz9\9`Z"                     YDmz99Z                      
(*n?Zvs{xy                     nZvsxy                       
1?Ci8HlG|Y                     1Ci8HlGY                     
z6Ol&H_>r.                     z6OlHr                       
@*TPM3`BH~                     TPM3BH                       
<^+r>rmZB6                     rrmZB6                       
75w+o.SO]N                     75woSON                      

Similar Messages

  • Removing non-alphanumeric characters

    Hello,
    New to Oracle (not so new to SQL) and this is my first post ... please be kind :-)
    Anyway, I have a variable length string that I would like to separate into separate rows/columns. the structure is as follows:
    |G^7130^R|C^7130^R|G^7131^R|C^7131^R|G^9900^R|C^9950^R|C^9951^R
    ... the leading alpha following the pipe is required in a column as is the numeric that follow. I have tried ...
    REGEXP_REPLACE(string, '[^[:digit:]]',',') which gave me ...
    ,,,7130,,,,,7130,,,,,7131,,,,,7131,,,,,9900,,,,,9950,,,,,9951,,
    ..wrong...
    I am trying to produce ..
    code value
    G 7130
    C 7130
    etc
    Anyway any help would be appreciated .... and yes I am going through the literature as fast as I can ... well at least as fast as I can comprehend.
    Thanks.
    A

    I am seeking some assistance on the implemenation of the above solution. I have modified the query (below) and am unsure of why the performance is so poor (no crticism to the contributers). When I run the Explain Plan against the SQL the total cost is very low (<50) ... yet when I run the query it does not return within hours (I cancel the process). Does anyone have any advice on this one? I have to be missing something here. Any help would be appreciated. Thanks.
    Regards,
    Al
    Additional Info
    -the largest table (request) has ~2.6 million rows the others <5000
    -request index is:
    ALL_DONE
    REQNO
    LABNO
    -for the query below the set to be considered (pre-parsing) is only 171 rows. The first 50 come back in seconds but when I fetch the rest it does not return
    select
    distinct
    rsl.ReqNo,
    rsl.LabNo as RSL_Labno,
    td.labno as DeptLabno,
    td.dept,
    case
    when td.dept=1 then 'C'
    when td.dept=2 then 'H'
    when td.dept=3 then 'M'
    when td.dept=4 then 'I'
    when td.dept=5 then 'P'
    when td.dept=6 then 'BB'
    when td.dept=7 then 'R'
    when td.dept=7 then 'MD'
    end as Dept2,
    ld.ldptname,
    rsl.code,
    rsl.test_code,
    tm.alf_key,
    tm.short_desc,
    tm.text,
    tm.end_date,
    tm.orderable
    from
    with t1 as
    (select
    r.reqno as ReqNo,
    r.labno as LabNo,
    ti.tests as str
    from
    request r,
    testinfo ti
    where 1=1
    and r.labno=11
    and r.all_done = 0
    and r.sp_dt>'01-JUN-08'
    and r.reqno is not null
    and r.reqno= ti.reqno
    and r.labno= ti.labno),
    t2 as
    (select
    regexp_substr(str,'[^|]+',1,level) sub_str,
    ReqNo,
    LabNo
    from t1
    connect by level<=nvl(length(regexp_replace(str,'[^|]')),1))
    select
    ReqNo,
    LabNo,
    substr(sub_str,1,1) code,
    regexp_substr(sub_str,'[[:digit:]]+') test_code
    from t2
    rsl,
    testmaster tm,
    testdept td,
    ldpt ld
    where
    1=1
    and tm.test=rsl.test_code
    and tm.test=td.test
    and rsl.Labno=td.labno
    and ld.labno=td.labno
    and ld.dept=td.dept
    and tm.end_date='31-DEC-49'
    and td.end_date='31-DEC-49'
    order by ReqNo, test_code asc;

  • Removing Non-numeric characters from Alpha-numeric string

    Hi,
    I have one column in which i have Alpha-numeric data like
    COLUMN X
    +91 (876) 098 6789
    1-567-987-7655
    so on.
    I want to remove Non-numeric characters from above (space,'(',')',+,........)
    i want to write something generic (suppose some function to which i pass the column)
    thanks in advance,
    Mandip

    This variation uses the like operators pattern recognition to remove non alphanumeric characters. It also
    keeps decimals.
    Code Snippet
    CREATE FUNCTION dbo.RemoveChars(@Str varchar(1000))
    RETURNS VARCHAR(1000)
    BEGIN
    declare @NewStr varchar(1000),
    @i int
    set @i = 1
    set @NewStr = ''
    while @i <= len(@str)
    begin
    --grab digits or (| in regex) decimal
    if substring(@str,@i,1) like '%[0-9|.]%'
    begin
    set @NewStr = @NewStr + substring(@str,@i,1)
    end
    else
    begin
    set @NewStr = @NewStr
    end
    set @i = @i + 1
    end
    RETURN Rtrim(Ltrim(@NewStr))
    END
    GO
    Code to validate:
    Code Snippet
    declare @t table(
    TestStr varchar(100)
    insert into @t values ('+91 (8.76) \098 6789');
    insert into @t values ('1-567-987-7655');
    select dbo.RemoveChars(TestStr)
    from @t

  • Non-alphanumeric characters in textarea causing 404 errors

    I'm only just becoming acquainted with Coldfusion, as I've been asked to fix a problem in an existing system. The system consists of a simple html form containing a text area, among other input fields. The form is submitted to a cfm script, which displays a confirmation page and sends a couple of emails. The problem is that whenever the user enters any (as far as I can tell) non-alphanumeric characters, e.g. quotes, commas or brackets, in the textarea field, they get a 404 response from the server.
    I tried a number of things to identify the problem, including escaping the text in javascript before submission, but didn't get anywhere. The last thing I tried was installing a local version of the CF on my workstation, hoping to reproduce the problem and thus debug it more easily. However, on my local CF setup the problem does not occur.
    Can anyone help me debug this please? Thanks,
    Marcin

    Thanks for your response. The form method is "post". The only thing that the CFM handler does with this field (gametestexperience) is include it at the bottom of an email message:
    <CFMAIL TO="[email protected]"
    FROM="#email#"
    SUBJECT="Tester Application"
    type="html"
    server = "Cluster9.us.messagelabs.com">
      Automatically logged from the internet form:<p><p>
    <table>
    <tr><td>EmailFrom</td><td>#email#</td>
    <tr><td>From</td><td>#firstName# #lastName#</td></tr>
    <tr><td>Sent</td><td>#DateFormat(Now())#</td></tr>
    <tr><td>Referrer</td><td>#referer#</td></tr>
    <tr><td>Confirmation</td><td>#agree1#, #agree2#, #agree3#, #agree4#, #agree5#</td></tr>
    <tr><td>FamilyCompetitor</td><td>#familycompetitor#</td></tr>
    <tr><td>FamilyWork</td><td>#familywork#</td></tr>
    <tr><td>ReferredBy</td><td>#referredBy#</td></tr>
    <tr><td>RefererDetails</td><td>#refererdetails#</td></tr>
    <tr><td>FirstName</td><td>#firstName#</td></tr>
    <tr><td>LastName</td><td>#lastName#</td></tr>
    <tr><td>Email</td><td>#email#</td></tr>
    <tr><td>TelephoneHome</td><td>#telephoneHome#</td></tr>
    <tr><td>TelephoneCell</td><td>#telephoneCell#</td></tr>
    <tr><td>TelephoneDay</td><td>#telephoneDay#</td></tr>
    <tr><td>City</td><td>#homeTown#</td></tr>
    <tr><td>Employment</td><td>#employment#</td></tr>
    <tr><td>GamerType</td><td>#gamerType#</td></tr>
    <tr><td>GamerStyle</td><td>#gamerStyle#</td></tr>
    <tr><td>HoursPerWeek</td><td>#hoursPerWeek#</td></tr>
    <tr><td>PreferredGenres</td><td>#preferredGenres#</td></tr>
    <tr><td>Consoles</td><td>#console#</td></tr>
    <tr><td>GamesPlayed</td><td>#gameplayed#</td></tr>
    <tr><td>Available</td><td>#available#</td></tr>
    <tr><td>TestedBefore</td><td>#testedBefore#</td></tr>
    <tr><td>TestingExperience</td><td>#gametestexperience#</td></tr>
    </table>
      Thanks,<P>
      Focus Test Team!<P>
    </CFMAIL>

  • [solved] Non-alphanumeric characters broken in TinyChat

    Hello, fellow archers.
    I've been having a bit of trouble with the TinyChat site. Most non-alphanumeric characters are being displayed as crossed-out boxes. This problem is exclusive to TinyChat and has not occured in any other Flash applications.
    An example of the broken characters:
    Note how the / and > characters are not broken.
    This is the second installation of ArchLinux on my computer, the problem occured on the current install only. I suspect the problem is caused by a missing package, though the only hint I was able to find was installing the ttf-ms-fonts package (https://wiki.archlinux.org/index.php/br … ash_Player). This did not resolve the issue.
    Package versions:
    firefox 34.0.5-1
    flashplugin 11.2.202.425-1
    I'll gladly provide any other information that could help resolve this issue.
    Last edited by skoftoby (2015-01-21 18:31:26)

    Head_on_a_Stick wrote:
    skoftoby wrote:I'd like to request this topic be marked as solved either way.
    As with most things Arch, you have to do this yourself -- edit the title of your first post & put "[SOLVED]" at the beginning.
    Whops. The subject length was exactly at the maximum length, and since I couldn't edit the title any further, I thought a moderator had to edit it. Apologies!

  • How to discard non alphanumeric key in a string ?

    Dear all,
    To start an application  that i have developped, i would like that the user write its password in the first panel but i want that each time that user enter a character in the string control Hide_Password (see attached picture), this one is automatically convert in a "." to hide the password . The real password is saved in a second string control. It is actually what my vi is doing by using a Key Up event. But now i want to prevent any non alphanumerical character to be enter in the password, especially i do not want that the user can press the menu key as <Ctrl>, <Shift>, <Alt>, <Command>, and <Option> and also the <Left>, <Up>, <Right>, <Down>. I suppose that i have to use Key Down? event by discarding all the key that i do not want but i am sure that there is a more easy way to do it.
    Do you have any idea ?
    Morover, If you think that there is something wrong in my vi, please let me know.
    Thanks
    Philippe 
    Solved!
    Go to Solution.
    Attachments:
    FrontPanel.png ‏12 KB
    BlockDiagram.png ‏43 KB

    The real password is saved in a second string control.
    One thing you shouldn't do is use a (hidden?) String control for data storage.  Use the one control for data input (as a password as others have suggested) and pass the data throughout your program with a wire.
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • Non-Alphanumeric Character in a String

    I understand if we have a non-alphanumeric character in a String, we have to put a backward slash in front of that character. For example, we have to put a backward slach in front of a "backward slash". Eg. we do \\ to put a backward slash in a String.
    What about a dot (.) or a dash (-)? Do we have to do the same thing?

    No, it's only for control characters like "newline", characters with special meaning in strings i.e. " and \ and any character that can't be represented in the character encoding of your java source file.

  • How to support non alphanumeric characters when using WORLD_LEXER?

    BASIC_LEXER has an attribute of printjoins which we can specify the non alphanumberic characters as normal alphanumberic in query and included with the token. However, WORLD_LEXER doesn't have this attribute. So in order to use some non alphanumberic characters and treat them as alphanumberic characters in Oracle Text Index, such as ><$, what should I can?
    Thanks in advance for any help.

    I use WORLD_LEXER to create Oracle Text Index to support UTF-8.
    Below is the script to create table and index:
    REM Create table
    CREATE TABLE my_test
    ( id VARCHAR2(32 BYTE) NOT NULL,
    code VARCHAR2(100 BYTE) NOT NULL,
         CONSTRAINT "my_test_pk" PRIMARY KEY ("id"));
    REM create index
    exec ctx_ddl.create_preference('stars_lexer','WORLD_LEXER');
    exec ctx_ddl.create_preference('stars_wordlist', 'BASIC_WORDLIST');
    exec ctx_ddl.set_attribute('stars_wordlist','substring_index','TRUE');
    exec ctx_ddl.set_attribute('stars_wordlist','PREFIX_INDEX','TRUE');
    -- create index for Table corrosion level
    CREATE INDEX my_test_index
    ON my_test(code)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS ('LEXER stars_lexer STOPLIST stars_stop WORDLIST stars_wordlist SYNC(EVERY "SYSDATE+5/1440") TRANSACTIONAL');
    INSERT INTO my_test('1', 'English word1');
    INSERT INTO my_test('2', '违违');
    INSERT INTO my_test('3', '违违&^|违违');
    When I query:
    select * from corrosion_levels r where contains(r.CORROSION_LEVEL, '{%违${|违%}') > 0
    ID CODE
    3 违违$(|违违
    2 违违
    Actually, the result what I want is: 3 违违$(|违违
    So the requirement is that all non-alphanumeric characters should be treated as normal alphanumeric charcters. Please tell me how to implement it.

  • Sqlloader -350   illegal combination of non alphanumeric character

    hi all,
    i'm using owb 10.2.0.1
    i have a file in my D:\2122008.txt and a table in oracle DB
    created a map from file to table.....
    generated a code and saved in D:\orahome_1\owb\codegen\ctl\Employee.ctl
    deployed in target database...
    when is start from OWB i get the following error
    RPE-01013: SQL Loader reported error condition, number 1.
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Mar 6 17:50:01 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL*Loader-500: Unable to open file (d:\EMPLOYEE.ctl)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: The system cannot find the file specified.
    so i planned to run by invoking sql*loader..
    this is the generated code
    OPTIONS (BINDSIZE=50000,ERRORS=50,ROWS=200,DIRECT=TRUE,READSIZE=65536,FILE='F_21022008_TXT')
    CONTINUE_LOAD DATA
    CHARACTERSET WE8MSWIN1252
    INFILE '{{FILE_EMP_LOCATION1.RootPath}}{{}}21022008_TXT'
    DISCARDMAX 0
    CONCATENATE 1
    INTO TABLE "DMT_ADMIN"."AZBJ_ONEEMPLOYEE_DATABASE"@"dwhtest"
    APPEND
    REENABLE DISABLED_CONSTRAINTS
    FIELDS TERMINATED BY X'09' OPTIONALLY ENCLOSED BY 'X' SKIP 0
    "REC_SRNO" POSITION(1) INTEGER EXTERNAL ,
    "EMPLOYEENUMBER" INTEGER EXTERNAL ,
    "EMPLOYEENAME" CHAR ,
    "EMPDOB" CHAR ,
    "GENDER" CHAR ,
    "DEPARTMENT" CHAR ,
    "DESIGNATION" CHAR ,
    "OPUSCODE" CHAR ,
    "BRANCHCODE" CHAR ,
    "OFFICEMAIL" CHAR ,
    when i execute in sqlldr it is openeing the ctl file but gives the following error
    sql*loader-350: syntax error at line 21
    illegal combination of non-alphanumeric characters
    INTO TABLE "DMT_ADMIN"."AZBJ_ONEEMPLOYEE_DATABASE"@"dwhtest"
    the error is comming at the symbal "@"
    tried out several ways but could'nt resolve the prob
    anyone out there to help me....

    shld i need to keep the source files where OWB server is installed or can i run the process by keeping the files in my client systems local directory?

  • SQL*Loader-350: Illegal combination of non-alphanumeric characters

    Hi all,
    how to skip a column in control file.
    i.e.
    I have a table with 10 columns and FAT file contains 11 columns.
    how to skip a last column ?
    and
    I added extra column to Table and I changed the control file too.
    but i am getting error.
    SQL*Loader-350: Syntax error at line 115.
    Illegal combination of non-alphanumeric characters
    thanks in Advance.

    Tom Kyte has an elaborate solution on his page:
    http://osi.oracle.com/~tkyte/SkipCols/index.html
    Or post the table description and the control file, so we can have a look at it.

  • BUG: registered servers missing when password contains non-alphanumeric

    I have a fresh installation of DS7 using Sun Java Web Server 7 to host DSCC7. Using DSCC7 web interface I click New Server and the procedure appears to complete successfully (no errors during creation, registration successful). However in the web interface the new server is not listed.
    From the command line the new server is listed.
    $ /opt/SUNWdsee7/bin/dsccreg list-servers
    Hostname Port sPort Type Owner Flags iPath Description
    www-c-directory 389 636 DS nobody /var/opt/SUNWdsee7/internal
    Cause: the DSCC administrator's password contained non-alphanumeric characters (e.g. a left-angle bracket plus a few other punctuation characters) with about 10 characters in total.
    Solution: from the web interface I navigated to Settings, Directory Service Managers, and changed the password for "admin" to a simpler password containing only alphanumeric characters.
    Resolution: the registered servers now appear in the DSCC7 web interface as well as the command line. Oddly I can now return the password back to its original value and the servers still appear in the web interface.
    Edited by: nhand42 on Jan 10, 2010 4:53 PM

    English / C 7-bit ASCII.
    The software has been installed inside a Whole Container, and the container was manually sysidcfg'd after the zone's installation (before the software installation) using zlogin -C.
    Edited by: nhand42 on Jan 11, 2010 2:31 PM

  • Removing non-numeric characters from string

    Hi there,
    I need to have the ability to remove non-numeric characters from a string and I do not know how to do this.
    Does any one know a way?
    Example:
    Present String: (02)-2345-4607
    Required String: 0223454607
    Thanks in advance

    Dear NickM
    Try this this will work...........
    create or replace function char2num(mstring in varchar2) return integer
    is
    -- Function to remove Special characters and alphebets from phone no. string field
    -- Author - Valid Bharde.(India-Mumbai)
    -- Date :- 20 Sept 2006.
    -- This Function will return numeric representation.
    -- The Folowing program is gifted to NickM with respect to his post on oracle site regarding Removing non-numeric characters from string on the said date
    mstatus number :=0;
    mnum number:=0;
    mrefstring varchar2(50);
    begin
    mnum := length(mstring);
    for x in 1..mnum loop
    if (ASCII(substr(upper(mstring),x,1)) >= 48 and ASCII(substr(upper(mstring),x,1)) <= 57) then
    mrefstring := mrefstring || substr(mstring,x,1);
    end if;
    end loop;
    return mrefstring;
    end;
    copy the above program and use it at function for example
    SQL> select char2num('(022)-453452781') from dual;
    CHAR2NUM('(022)-453452781')
    22453452781
    Chao!!!

  • Removing non printable characters from an excel file using powershell

    Hello,
    anyone know how to remove non printable characters from an excel file using powershell?
    thanks,
    jose.

    To add - Excel is a binary file.  It cannot be managed via external methods easily.  You can write a macro that can do this.  Post in the Excel forum and explain what you are seeing and get the MVPs there to show you how to use the macro facility
    to edit cells.  Outside of cell text "unprintable" characters are a normal part of Excel.
    ¯\_(ツ)_/¯

  • Removing non-printable characters

    Hi All,
    I was suppose to remove all non-printable characters, hence created below function. But in trouble for some rows in table.
    function ar1(i_value in varchar2)
    return varchar2
    as
           pattern varchar2(1000) := '][';
           l_strVal varchar2(1000);
    begin
           for i in 32 .. 126 loop
              pattern := pattern || case when chr(i) = '''' then ''''''
                                         when chr(i) in ('[', ']') then null
                                         else chr(i)
                                    end;
           end loop;
              l_strVal := regexp_replace(i_value, '([' || pattern || '])|.', '\1', 1, 0, 'n');
    return l_strVal;
    end;
    /Could anyone please help me, is this right way to do it.
    Problem is occurring for one row as shown below.
    SQL> select num, ar1(author) author1, author from doc where doc_num =37;
       NUM
    AUTHOR1
    AUTHOR
      15098137
    OM LESRAVI{|~
    OM LES
    RAVIIts removing non-printable characters but not sure how these {|~ are included in the resultant.
    Would be great if anyone can help me.
    Edited by: YasserRACDBA on Nov 9, 2010 3:53 PM

    Thanks....but even your method is giving worng result as shown below.
    SQL> select regexp_replace(author,'[[:cntrl:]]')
      2  from doc where doc_num =15098137;
    REGEXP_REPLACE(AUTHOR,'[[:CNTRL:]]')
    OM LESRAVI{|~Is there any clue please...how come those {|~ are there??                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Merge files and remove non-static elements

    Where is the feature that allowed images to be merged while removing non-static elements.  I saw a demonstration of removing people from a scene when multiple pictures were taken and the people had changed their positions. This was touted as a feature found only in PS extended a few years ago. I have never been able to locate it.

    This involves an "Image Stack". See http://help.adobe.com/en_US/photoshop/cs/using/WS1E389632-4B37-425e-8EAB-1384C0B432D3a.htm l

Maybe you are looking for