Sql to remove brackets non ascii charaters

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
Hi there,
I have a requirement to remove the any non alphabets like brackets, , quotes and non ascii, languages other than english and everything in lower case. The select is simple
select
lower(customer_name)
from
  customer_data
where  CONVERT ( customer_name, 'US7ASCII')     = customer_nameHowever, I also want to add maybe the replace function on the customer name, such that the brackets, ", ', / - or any other such character can be removed. I tried unsuccessfully something like
{code}
select replace('cvp, llc','''-/,,".') from dual
I wanted to do something on those lines on my first query so that I only get english alphabets customer names, stripping off all the non english charaters and any non-english characters.
Could you please advise?
Thanks,
Ryan
Edited by: ryansun on Nov 15, 2012 6:09 AM
Edited by: ryansun on Nov 15, 2012 6:10 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Hi Chris,
if you want to use TRANSLATE then you have to modify it a bit:
WITH customer_data AS
   SELECT 'cvp, llc' AS customer_name FROM DUAL
SELECT translate(customer_name,'abcdefghijklmnopqurstuvwxyzABCDEFGHIJKLMNOPQURSTUVWXYZ1234567890'
                ,'abcdefghijklmnopqurstuvwxyzABCDEFGHIJKLMNOPQURSTUVWXYZ1234567890') txt
  FROM customer_data;
TXT    
cvp, llc
WITH customer_data AS
   SELECT 'cvp, llc' AS customer_name FROM DUAL
WITH customer_data AS
   SELECT 'cvp, llc' AS customer_name FROM DUAL
SELECT translate(customer_name,' '
                 ||'[''-/,".]' -- chars to remove here
                ,' ') txt
  FROM customer_data;
TXT   
cvp llc
{code}
Regards.
Al
Edited by: Alberto Faenza on Nov 15, 2012 3:52 PM
Modified query                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Non-ASCII charaters in a unix file

    Hi,
    Could you pls tell me how do i know the non-ascii/ascii characters in a unix file.
    Thanks

    in vi
    :set list
    $cat[b] -v abc.txt |more

  • Non-Ascii charaters

    Does acrobat.com supports non-ascii characters in file names?
    Please have a look on screen shots.
    Regards
    Bartek

    Is it possible to use unicode names?

  • Remove non ascii character

    i need a SQL or Procedure that will search non ascii character  in data and update the data by removing it
    Suppose there is table TABLE1 with Column NAME
    it contain number of row and few has non ascii character eg 'CharacterÄr'
    My sql or procedure should be able to search  'CharacterÄr' and update the row with 'Character'
    i.e. removing the non ascii character 'Ä' from the data

    Hi,
    Okay, in that case:
    SELECT str
    ,      REGEXP_REPLACE ( str
                          , '[^[:cntrl:] -~]'
                          )   AS new_str
    FROM    table_x
    or, to actually change the rows that contain the bad characters:
    UPDATE  table_x
    SET     str = REGEXP_REPLACE ( str
                                 , '[^[:cntrl:] -~]'
    WHERE   REGEXP_LIKE ( str
                        , '[^[:cntrl:] -~]'

  • Remove non ASCII from a text loaded to a table

    I would like to use SQLLDR to load a text file to a table.
    But I would like to remove all non ASCII from the data either
    1. During SQL LOAD
    2. Or through a stored procedure.
    Could this be done in Oracle?

    I have done this on an insert trigger in the past, searching for ascii 0.
    In my case it went someting like this:
    FOR chr_indx  IN 1 .. length(:new.problem_string) loop
      IF ascii(substr(:new.problem_string,chr_indx,1)) = 0 then  --search here for what you consider is a problem character(s)
        --fix the problem
      end if;
    end loop;

  • Removing Non-Ascii Characters from a String

    Hi Everyone,
    I would like to remove all NON-ASCII characters from a large string. For example, I am taking text from websites and would like to remove all the strange arabic and asian characters. How can I accomplish this?
    Thank you in advance.

    I would like to remove all NON-ASCII characters from a large string. I don't know if its a good method but try this:
    str="\u6789gj";
    output="";
    for(char c:str.toCharArray()){
         if((c&(char)0xff00)==0){
              output=output+c;
    System.out.println(output);
    all the strange arabic and asian characters.Don't call them so.... I am an Indian Muslim ;-) ....
    Thanks!

  • How to remove non-ASCII charcters from an XML generated using Simple Transf

    Hi,
    I am currently facing a problem where I invoke a ST like
    CALL TRANSFORMATION ZTEST
      source root = str
      result xml rawstr.
    to prepare an XML using the contents of the ABAP variable str.
    In my case sometime the variable str can contain non-ASCII characters. What I find is that ST do not remove these characters and the final XML that get generated thus contains non-parsable xml charcaters.
    Is there an efficient way to remove/replace such non-ascii characters within the ST such that my final XML is consumable by any xml parser. I do not want to do a second level of processing by running through the output xml and removing the charcaters individually, because in our system the number of xml messages generated is very high and any such lookup-replace algorithm terms out to be too coslty.
    Regards,
    Vikas Lamba

    Hi
    may be you know this syntax :)
    <?xdofx:substr(SHIP_TO_LOCATION_NAME,11,44)?>
    Rahul

  • Removing Non Ascii Characters.

    Dear Friends,
    In our application, User copying some data from a document and pasting in a field "Comments".
    If that data consists anything like bullets,arrows of word document. It is inserting some Non keyboard characters into database like below.
    • Analysys
    • Do
    • Now
    • When
    • As
    • We
    don’t know how much he love sthe testing’I am not crazyh’
    I AM ‘USER’ 
    
    
     Uu
     Yy
     tt
    Now user asking to remove all those Non-ASCII characters from Comments Column. Please help!

    Hi Santosh,
    I can remember that I have given you the REGEXP_REPLACE query earlier which you have specified and told you to read some document about it to modify according to your need. It is not very wise thing to depend on others every time.
    Re: Removing Junk Characters.
    Anyway, REGEXP_REPLACE(str,'[^[a-z,A-Z,0-9,chr(0)-chr(127)[:space:]]]*','') can give you some pointer (not tested).

  • Regex patern to remove non-ascii characters

    Hi,
    How to remove non-ascii character from input for a country france using RegEx.
    Could you please help us to contruct regex pattern from above?
    Thanks

    This isn't a complete answer, but is a good starting point:
    Regex any ascii character - Stack Overflow

  • Replacing non-ASCII characters with HTML charcter references

    Hi All,
    In Oracle 10g or greater is there a built-in function that will convert a string with non-ASCII characters like this
    a b č 뮼
    into an ASCII string with HTML character references like this?
    a b & # x 0 1 0 D ; & # x B B B C ;
    (note I had to include spaces between each character in the sample code for message to prevent the forum software from converting my text)
    I tried using
    utl_i18n.escape_reference( val, 'us7ascii' )
    but for some reason it returns
    a b c & # x B B B C ;
    Note how it converted the Western European character "č" to its unaccented counterpart "c", not "& # x 0 1 0 D ;" (is this a bug?).
    I also tried a custom solution using regexp_replace and asciistr (which I can't include here because the forum software chokes on it) but it only returns the correct result for values <=4000 characters long. Unfortunately asciistr doesn't appear to accept CLOB values larger than 4000 characters. It returns an error message like
    (ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 30251, maximum: 4000) ).
    I'm looking for a solution that works on CLOB data of any size.
    Thanks in advance for any insight you can provide.
    Joe Fuda

    So with that (UTF8) in mind, let's take another look.....
    As shown below, I used a AL32UTF8 database.
    Note: I did not use a unicode capable tool for querying. So I set console mode code page to 1250 just to have č displayed properly (instead of posing as an è).
    Also, as a result of using windows-1250 for client character set, in the val column and in the second select's ncr column (iso8859-1), è (00e8) has been replaced with e through character set conversion going from server back to client.
    Running the same code on a database with a db character set such as we8mswin1252, that doesn't define the č (latin small c with caron) character, would yield results with a c in the ncr column.
    C:\>chcp 1250
    Aktuell teckentabell: 1250
    C:\>set nls_lang=.ee8mswin1250
    C:\>sqlplus test/test
    SQL*Plus: Release 11.1.0.6.0 - Production on Fri May 23 21:25:29 2008
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    With the OLAP option
    SQL> select * from nls_database_parameters where parameter like '%CHARACTERSET';
    PARAMETER              VALUE
    NLS_CHARACTERSET       AL32UTF8
    NLS_NCHAR_CHARACTERSET AL16UTF16
    SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'us7ascii') NCR from dual;
    VAL  NCR
    č e  c e
    SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'we8iso8859p1') NCR from dual;
    VAL  NCR
    č e  &# x10d; e     <- "è"
    SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'ee8iso8859p2') NCR from dual;
    VAL  NCR
    č e  č &# xe8;
    SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'cl8iso8859p5') NCR from dual;
    VAL  NCR
    č e  &# x10d; &# xe8;In the US7ASCII case, where it should be possible for all non-ascii characters to be escaped, it seems as if the actual escape step is skipped over.
    Hope this helps to understand whether utl_i8n is usable or not in your case.
    Message was edited by:
    orafad
    Fixed replaced character references :)

  • Problems with non-ASCII characters on Linux Unit Test Import

    I found a problem with non-ASCII characters in the Unit Test Import for Linux.  This problem does not appear in the Unit Test Import for Windows.
    I have attached a Unit Test export called PROC1.XML  It tests a procedure that is included in another attachment called PROC1.txt. The unit test includes 2 implementations.  Both implementations pass non-ASCII characters to the procedure and return them unchanged.
    In Linux, the unit test import will change the non-ASCII characters in the XML file to xFFFD. If I copy/paste the the non-ASCII characters into the Unit Test after the import, they will be stored and executed correctly.
    Amazon Ubuntu 3.13.0-45-generic / lubuntu-core
    Oracle 11g Express Edition - AL32UTF8
    SQL*Developer 4.0.3.16 Build MAIN-16.84
    Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
    In Windows, the unit test will import the non-ASCII characters unchanged from the XML file.
    Windows 7 Home Premium, Service Pack 1
    Oracle 11g Express Edition - AL32UTF8
    SQL*Developer 4.0.3.16 Build MAIN-16.84
    Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
    If SQL*Developer is coded the same between Windows and Linux, The JVM must be causing the problem.

    Set the System property "mail.mime.decodeparameters" to "true" to enable the RFC 2231 support.
    See the javadocs for the javax.mail.internet package for the list of properties.
    Yes, the FAQ entry should contain those details as well.

  • Issue with Download and Loss of Non-ASCII Characters

    I have a need to allow my user to download the contents of an HTML Region as a file. This region contains some Greek letters, i.e. non-ASCII, used with some common finance formulas.
    I am able to copy the contents off this region using JavaScript without any issue.
    Moreover, I can copy the contents from JavaScript into a Page Item and then render the region with PL/SQL. Again, this works without an issue.
    However, when I try to download the region, the Greek letters are lost in the downloaded document. Instead they are replaced with this weird series of characters: (Δ
    I've created a sample app to demonstrate this problem at apex.oracle.com:
    URL: http://apex.oracle.com/pls/apex/f?p=34765:1
    UID: GUEST_DEV
    PWD: greeksgone
    Click the button labeled "Copy HTML Via JS" and you will see the statically populated region copied into the second region.
    Click the button labeled "Copy HTML Via APEX" and you will see the statically populated region copied into the third region. This is achieved by copying the HTML into a Page Item and then submitting the page. When the page returns, the value of this Page Item is then used to populate the third region. As you can see, the Greek letters are there as normal.
    However, if you click the "Download HTML" button you will see the the Greek letters are not present in the resulting file.
    -Joe

    Joe Upshaw wrote:
    I am just totally stuck here.
    This is what the document looks like without the required meta tag:
    <HTML>
    <BODY>
    <STYLE>
    <DIV>
    div.riskScenarioMatrixDiv
    overflow:auto;
    ....This version does not display the greek letters.
    If I could simply add this one meta tag in, everything would work beautifully:
    <HTML>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <BODY>
    <STYLE>
    <DIV>
    div.riskScenarioMatrixDiv
    overflow:auto;
    ....However, I have tried every combination I can think of in the code block but, any time that I add that meta tag, I get a *404 Page Not Found* error.
    The only thing standing between what we have and what we need is getting that meta tag in the output but, I just can't seem to find a way to do this. Actually, we'd really like to have, within the head tags; the meta tag, the style and the title but, not being able to get that meta tag in is the difference between acceptable and broken. It works with the others in the body.
    DECLARE
    ls_RiskMatrixTitle  VARCHAR2(32767);
    ls_RiskMatrixHTML   VARCHAR2(32767);
    ls_DefaultFileName  VARCHAR2(512);
    BEGIN
    ls_RiskMatrixHTML   := :P1_HTML;
    ls_DefaultFileName  := 'TestMe.html';         
    ls_RiskMatrixTitle  := 'Test of Download';        
    OWA_UTIL.MIME_HEADER( 'text/html',  False, 'UTF8' );
    HTP.P( 'Content-Disposition: attachment; filename=' || ls_DefaultFileName );
    --HTP.META( 'Content-Type',  null, 'text/html; charset=utf-8' );          
    --HTP.TITLE( ls_RiskMatrixTitle ); 
    OWA_UTIL.HTTP_HEADER_CLOSE;
    HTP.HTMLOPEN;   
    HTP.BODYOPEN;
    HTP.STYLE('<DIV>' || :P1_MATRIX_STYLE || '</DIV>');
    HTP.P(ls_RiskMatrixTitle);
    HTP.P(ls_RiskMatrixHTML);
    APEX_APPLICATION.G_UNRECOVERABLE_ERROR := True;
    END;
    You appear to be confusing HTTP and HTML.
    The HTTP header != HTML <tt>head</tt> element.
    HTP.META( 'Content-Type',  null, 'text/html; charset=utf-8' );          
    HTP.TITLE( ls_RiskMatrixTitle );  This generates HTML content. It does not go in the HTTP header. You should be generating an HTML <tt>head</tt> element containing this (and the <tt>style</tt> element) between <tt>HTP.HTMLOPEN</tt> and <tt> HTP.BODYOPEN</tt>.
    Also note that these web toolkit methods generate really obsolete HTML, therefore I never use them (and nor does APEX these days).
    Don't have time to get more into this now...

  • Does Oracle User Password can contain non-ASCII characters?

    Hi Experts,
    Can we create a user with password containing non-ASCII characters like "Ro'çá".
    I was able to create a database instance by providing the password for sys as "Ro'çá". But now i am not able to login from command prompt using sqlplus or SQLPLUS Application. I am getting below error:
    C:\Documents and Settings\xyz>sqlplus system/Ro'çá@test
    SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jul 4 12:17:33 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    ERROR:
    ORA-12154: TNS:could not resolve the connect identifier specified
    Enter user-name:
    same in case i enclose the password in ""
    C:\Documents and Settings\xyz>sqlplus system/"Ro'çá"@test
    SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jul 4 12:17:33 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    ERROR:
    ORA-12154: TNS:could not resolve the connect identifier specified
    Enter user-name:
    same in case i enclose the password in ""
    Also using create user i am not able to create user with password in non-ASCII characters but alter user works and changes the password to non-ASCII characters when enclosed in quotes.
    I wanted to know whether the password can contain non-ASCII characters or not?
    Thanks in advance for your help.

    I don't think that the characters used are allowed. See this doc which only mentions three characters to be used .
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10575/tdpsg_user_accounts.htm#BEICECGF
    I did try the same but it didn't work for me either.
    SQL> select * from V$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> grant connect to user1 identified by Ro'çá;
    ERROR:
    ORA-01756: quoted string not properly terminated
    SQL> grant connect to user1 identified by "Ro'çá";
    Grant succeeded.
    SQL> connect uesr1/"Ro'çá";
    ERROR:
    ORA-01017: invalid username/password; logon denied
    Warning: You are no longer connected to ORACLE.
    SQL> connect uesr1/"Ro'çá"
    ERROR:
    ORA-01017: invalid username/password; logon denied
    SQL> connect uesr1/"Ro'çá"
    ERROR:
    ORA-01017: invalid username/password; logon denied
    SQL>HTH
    Aman....

  • URGENT!! Drill Down Error with Character Set non-ascii on Discoverer Viewer

    Hi,
    We have an error in a Drill down. It comes up when the Discoverer Viewer tries to process data that contains special character (non-ascii) in a query's filter. The same report that does not perform well with special characters, does perform well if the data don’t contains special characters, so it seems to be an issue processing non-ascii chars in this Discoverer Viewer instance.
    Ex. FIELD_NAME = 'öÜæäé (This filter is contained in a query that this getting an error msg="We're sorry, the server encountered an unexpected condition" ).
    It might be possible that there are some problems with the Discoverer charset ?
    We will appreciate any suggestion about this respect.
    Regrads,
    Seba.

    Sure,
    This is the hole sql command that get an error in a drill down action process
    SELECT NVL (sf_dw_people_skills.major_name, 'No Major'),
    sf_dw_people_skills.minor_name, sf_dw_people_skills.skill_name,
    sf_dw_people_skills.skill_level,
    sf_dw_people_all_rel_v.supervisor_name,
    sf_dw_people_all_rel_v.person_name, sf_dw_people_all_rel_v.LOCATION,
    sf_dw_people_all_rel_v.supervisor_dir_name, COUNT (1)
    FROM olnreport2.sf_dw_people_all_rel sf_dw_people_all_rel,
    olnreport2.sf_dw_people_skills sf_dw_people_skills,
    olnreport2.sf_dw_people_all_rel_v sf_dw_people_all_rel_v,
    olnreport2.sf_dw_competences_rel sf_dw_competences_rel
    WHERE ( (sf_dw_people_all_rel.person_id = sf_dw_people_skills.person_id
    AND (sf_dw_people_all_rel_v.person_id =
    sf_dw_people_skills.person_id
    AND (sf_dw_competences_rel.skill_id = sf_dw_people_skills.skill_id
    AND (sf_dw_people_all_rel_v.supervisor_id =
    sf_dw_people_all_rel.supervisor_id
    AND (sf_dw_people_all_rel_v.supervisor_name = 'Kunz, Jürgen Mr') /*When I replace the charset 'ü' by u, it´s work ok*/
    AND (sf_dw_people_skills.minor_name = 'HRMS')
    AND (sf_dw_people_skills.skill_name = 'HR Intelligence')
    AND ( sf_dw_competences_rel.competence_type = :"competence_type"
    AND sf_dw_competences_rel.competence_id IN ((:"competence_id"))
    AND (sf_dw_people_all_rel.supervisor_id IN ((:"Manager")))
    AND ((( :"resource_manager" <> -1
    AND olnreport2.do_val_person_job_prod
    ('RESOURCE_MANAGER_VIEW',
    sf_dw_people_skills.person_id,
    sf_dw_people_skills.job_code,
    sf_dw_people_skills.product_code,
    :"resource_manager"
    ) = 'Y'
    OR :"resource_manager" = -1
    GROUP BY NVL (sf_dw_people_skills.major_name, 'No Major'),
    sf_dw_people_skills.minor_name,
    sf_dw_people_skills.skill_name,
    sf_dw_people_skills.skill_level,
    sf_dw_people_all_rel_v.supervisor_name,
    sf_dw_people_all_rel_v.person_name,
    sf_dw_people_all_rel_v.LOCATION,
    sf_dw_people_all_rel_v.supervisor_dir_name;
    Regards,
    Seba.

  • Keyword import fails on non-ascii character

      I recently tried to import a long set of keywords (about 4000 terms).  i set up the file in excel and then tried to import the records.  I kept getting this message:  
    only text files encoded with ascii or unicode UTF-8 are supported when importing keywords.
    I finally tracked down the problem when i converted the file to a MS word text file, broke it down into parts and eventually found the problem record.  for some reason, the apostrophe in the words "don't know" had been corrupted to a weird character.  after i corrected this, everything worked. 
    however, this took a long time.   It would have been helpful if  lightroom could have at least pinpointed the line where the import failed or offered to convert non-compliant charaters to some specific character or set of characters.

    Yeah, that didn't work so well since SuperDuper ran across repeated errors trying to do so; I suspect it's something to do with the drive. (SuperDuper complains about WD's MyBook, which is what the drive is.) Because SD stops the entire copy operation on single errors, it'd be a painstaking process.
    Besides that, I like doing fresh installs of all the bits.

Maybe you are looking for

  • IPhone no longer recognized by ITunes, and Service is not starting

    Hi My IPhone is no longer recognized by ITunes. I already tried the steps on http://support.apple.com/kb/TS1495, but had no luck, and I also tried to remove all relevant Apple software and reinstall, but this did not result in anything either. Now, a

  • Trying to add a network printer. I downloaded and installed driver from manufacturer, but mac still reporting error

    I need to install a printer on my Macbook Pro. I downloaded and installed the driver from the manufacturer, Brother MFC 7820N. Then clicked the plus on add printer from System Preferences. I selected the printer I want to add as a nearby printer and

  • CSS Align right problem

    Hi I am using the following css to align a div to the right hand side of the page: #headerRight { RIGHT: 10px; MARGIN-RIGHT: 0px; POSITION: absolute; TOP: 5px; align: right; border: 0; width: 235px;} The above seems to work well, except for one small

  • Sorting a conditional list column doesn't roll up same results?

    I have a list with a column that adds the data of some other columns. When I look at the list in Standard View, and click on the column heading to sort, the dropdown looks like: Smallest on Top Largest on Top Clear Filter... 0 0 0 1 1 2 2 2 2 etc Why

  • Applescript: Help making it more efficent

    This is an Applescipt I cobbled together over the years for a daily process I need to run. It works great, but recently my file count has gotten so large it kills my machine and never completes.  I am running this against a folder that has about 500-