Select name without special characters

I have a table with names, some of which contain special characters('/','\','#','&'). I need to select the names columns with certain conditions.
1. The name with these special characters should not be picked, esp. when another same name (without the special characters exists
e.g: if I have 2 entries ABC& and ABC, I should select ABC
2. If no entries are clear of this special characters, pick the last name.
e.g: if I have 2 entries ABC& and ABC#, I should select ABC#.
Please help me device the code for this.

Hi,
Try something like this ...
select version from v$instance ;
<br>
VERSION
10.1.0.3.0
<br>
1 row selected.
<br>
create table test_values ( id number, val varchar2(10) );
<br>
insert into test_values values ( 1, 'abc' );
insert into test_values values ( 2, 'abc' );
insert into test_values values ( 3, 'abc/' );
insert into test_values values ( 4, 'abc\' );
insert into test_values values ( 5, 'abc#' );
insert into test_values values ( 6, 'def' );
insert into test_values values ( 7, 'def' );
insert into test_values values ( 8, '#ghi#' );
insert into test_values values ( 9, '/ghi/' );
insert into test_values values ( 10, null );
<br>
select id, val from test_values ;
<br>
        ID VAL
         1 abc
         2 abc
         3 abc/
         4 abc\
         5 abc#
         6 def
         7 def
         8 #ghi#
         9 /ghi/
        10
<br>
10 rows selected.
<br>
select
  max(id) keep
    ( dense_rank last
      order by instr(standardized_val,'#') desc, id
    ) as target_id,
  max(val) keep
    ( dense_rank last
      order by instr(standardized_val,'#') desc, id
    ) as target_val
from
  ( select id, val,
      translate( val, '/\#&', '####' ) standardized_val,
      translate( val, 'x/\#&', 'x' ) clean_val
    from test_values
  ) tv
group by
  clean_val
<br>
TARGET_ID TARGET_VAL
         2 abc
         7 def
         9 /ghi/
        10
<br>
4 rows selected.Message was edited by: jfuda - added tags for formatting source

Similar Messages

  • The email account name contains special characters

    im trying to create a apple id without payment method for my cousin. his email does not contains any special character and it's a valid email...my problem is that "the email account name contains special characters" message is always showing..any help please. thanks

    Goto the Email set up, it will show you the Current Email accounts you have set up, there will be an option to "Edit" You can change the Display Name (what other's see in the From line) and Account Name, what shows up when you mouse over your email icon on your Blackberry.
    Brownie
    Tour 9630
    IT Professional

  • Issue in creating a add link to a document content type on a doc lib name with , / special characters

    hi,
    i am having a  requirement to create/use "add link to a document" content type for a item in the document library.
    so i got  the code from below site :
    http://howtosharepoint.blogspot.in/2010/05/programmatically-add-link-to-document.html
    my issue is, if teh document  library names are single words - like MOM, model, procedures etc this  functionality is working fine and i am able to view the link to a document as an item. 
    but when the doc lib name contains special characters like , or  /  , this link to a  document  content type functionality is NOT working.
    can anyone pls point me whether this is the  actual  issue ? ie, if  the doc lib name contains special chars  like , or /  my
    add link to a document wont work? is there any restrictions/limitations for doc lib names in SharePoint ?
    for eg: my doc lib names are :
    1) Report and analysis, Data
    2) form / template
    3) map/ plot
    help is highly appreciated!

    hi,
     its talking abt the subsite names and  folders and NOT the document librraies.
     is there any link which gives the naming convention / restricted names for  document libs or  splists , from msdn / blogs.technet.
    thnx

  • Need help in setting file name with special characters in attachment

    Hi
    We have a requirement where we need to set the file name that contains special characters (like Russian) and send mauil using Java mail.
    If we set the file name as such, the attachment in the email contains garbled filename
    Can you pl let me know how to resolve this?
    We should use the file name as attachment name and this will have say special characters. The receiver who gets the mail should get with the correct attachment name
    One important point.. the attachments are opened from MS outlook.
    Thanks and regards
    Ram
    Edited by: 884910 on 13 Sep, 2011 5:00 AM

    Read the FAQ carefully. You don't need to call encodeText unless you're using a really
    old version of JavaMail.
    And, it depends on whether the mail reader you're using is handling encoded parameters
    according to the (new) MIME standard, or according to the (old) non-standard hack.
    Sadly, without knowing what mail reader the recipient is using, it's impossible to use
    encoded filenames that will work everywhere.

  • Mac file name restrictions/special characters

    What are the Mac OS file name restrictions? What are the special characters to avoid?
    Is this a legitimate file name? Are the colons allowed?
    /Users/Joe/Desktop/MyDocument 3:2:06.xls
      Windows XP Pro  

    Thanks, Sagesse. I'm new to the Mac OS. Is it tied to Unix in such a way that the colons are allowed?
    A user tried to provide a file with a name similar to that in my original post (e.g. "name 3:4:07.rtf") using a web form, and I'm at a loss as to how they could have saved it with the colons. Thank you for your assistance.

  • How  create data type for coulmn name having special characters in IR

    hi ,
    any idea how to create how to do create data type for coulmn name having special characters

    Hi Amit,
    Can you ellaborate ?
    Actually if you are reading a file(or anything else) which contains special characters, the data type can be created as done for other interfaces. But it is in the adapters that we actually take care of handling these special characters.
    ShabZ

  • How to select and change special characters

    Hi all,
    In my document wherever a, e, i, o, u comes in RED color that i want to add one black dot below that characters.
    Now what we do is place one dot then use baseline shift after that use kerning upto 400 like that only.
    Job font is Palatino Lt Std.
    Its time consuming a lot!!!
    Write now i am using GREP options only.
    or
    Myself creating script for wherever RED color comes it create a character style  after that i did it  manually without seeing the  Manuscript.
    My script follows:
    Any script is availble which i can select and change it.

    Can anyone look into my previous thread?
    Please find my attachment first, after that definitely you got an idea.
    Awating for your reply....
    by
    Learner

  • Deleting table name containing special characters/length

    hey all -
    a modeling program (erwin) created this table, which i am currently unable to drop. i am using dbvisualizer to connect to the db. the table name is:
    DBDB.BIN$6YefzzGY8ingMAB/AQBlXA==$0
    trying to kill it:
    drop table DBDB.BIN$6YefzzGY8ingMAB/AQBlXA==$0
    ORA-00933: SQL command not properly ended
    drop table "DBDB.BIN$6YefzzGY8ingMAB/AQBlXA==$0"
    ORA-00972: Identifier is too long
    drop table 'DBDB.BIN$6YefzzGY8ingMAB/AQBlXA==$0'
    drop table '"DBDB.BIN$6YefzzGY8ingMAB/AQBlXA==$0"'
    drop table 'DBDB.BIN$6YefzzGY8ingMAB/AQBlXA\=\=$0'
    drop table '"DBDB.BIN$6YefzzGY8ingMAB/AQBlXA\=\=$0"'
    ORA-00903: invalid table name
    i have played with some other things as well. still can't kill it - any suggestions?? tell me how to kill this thing!!

    please read the posting below:
    deleted item in oracle

  • Can I create a Coding Mask without special characters?

    Good morning,
    Our client wants a project code with the following masks:
    XX0000-0000.
    Please advise how to proceed with it.
    Best regards,
    Nat

    Hi Nat,
    u cant have both numeric and alphanumeric in single word "XX0000". U can make the same as "XXXXXX"
    and there should be a specific project ID and Project ID and coding mask should be separated by a special character.
    u can make the coding mask as explained below
       Project ID     CODING MASK
    1)  A               :XX-0000-0000
    2) A               :XXXXXX-0000
    REGARDS
    Avinash

  • JAXB compiler for class names with special characters

    Hi,
    I trying to run the xjc against an XSD where element names (class names) have an "_" in them. For eg ACCOUNT_AKG.
    JAXB creates a class ACCOUNTAKG and omits the "_". I need "_" to be preserved in the class name of the class is generated.
    Can someone show me the right direction , so I can create classes with "_" preserved in the class name.
    This would be a big help
    thanks
    Jax

    Hi,
    I trying to run the xjc against an XSD where element names (class names) have an "_" in them. For eg ACCOUNT_AKG.
    JAXB creates a class ACCOUNTAKG and omits the "_". I need "_" to be preserved in the class name of the class is generated.
    Can someone show me the right direction , so I can create classes with "_" preserved in the class name.
    This would be a big help
    thanks
    Jax

  • Special Characters in Thesaurus

    I have a requirement to be able search on all variations of a name. I tried using the RT tag in a thesaurus which worked for names without special characters.
    The names I need to search on include quotes and dashes. I have not been able to come up with a right combination of escaping the search and populating the thesaurus.
    Example: 'AB-AC 'AA
    How would I escape this on the query?
    How to I enter this in the thesaurus? Do I include the special characters?
    Thanks

    Check this
    http://download-east.oracle.com/docs/cd/B10501_01/text.920/a96518/cqspcl.htm#1360

  • WiFi Network Name with Underscore Special Characters Issue

    Turns out that iPod Touch doesn't like wireless network names with special characters (e.g. underscores) in them (I had 2 underscores in mine).
    It will establish a connection, get an IP address, even use WEP but won't talk to the Internet if the wireless access point name has an underscore in it. If you can change your wireless network name to remove the special characters the iPod Touch becomes very and will connect using the Internet.

    I'm looking for a way to escape all characters (not only the minus sign) except for a specific character. Kind of like 'unescaping' a specific character (the '%' sign) within braces {}What about if you apply a function like regexp_replace to escape all known "specific characters", and then unescape the particular specific character again back as e.g. in
    SQL>  select 'a.da-df%df*' str, replace (
                                                   regexp_replace (
                                                        'a.da-df%df*',
                                                        '([[:punct:]])',
                                                        '\\\1'
                                                   str2
      from dual
    STR         STR2         
    a.da-df%df* a\.da\-df%df\*
    1 row selected.i.e. don't escape with curly brackets but with the backslash character.
    You can then use this string in your query like in
    WHERE CONTAINS(r.POI_NAME, '<query> <textquery grammar="context"> <progression><seq>'
    ||'aaab'
    ||'</seq><seq>'
    ||'aaa\-b'
    ||'%</seq></progression> </textquery> </query> ' ,1)> 2

  • Prevent using special characters in file and folder names?

    I've recently begun adding windows clients to my network. In doing so, I've found that on my file shares from OS X server, the windows clients are unable to see files and folders which have names containing special characters such as / ? < > \ : * | ”
    Unfortunately my accounting department has been creating files with these characters in their names for several years. I would like to find if there is a way to prevent them from using a defined set of characters in the file and folder names to prevent them from "accidentally" doing so in the future.
    I've found that by turning off streams support on SMB in OS X server, that my windows clients can at least see that a file or folder should exist, albeit with a corrupted file name. Removing the special characters from these names allows the proper name to become visible and the file accessible.
    Any info would be greatly appreciated.

    (_seb_) wrote:
    > Gary White wrote:
    >> On Sun, 19 Nov 2006 19:15:04 +0100, "(_seb_)"
    <[email protected]> wrote:
    >>
    >>> "ça alors: it's a déjà-vu"
    >>>
    >>> How can I encode this so it's valid as a
    directory name, yet can be
    >>> displayed as intended when the name is output to
    the page.
    >>> urlencode() does not do the job, neither does
    htmlentities()...
    >>
    >>
    >> What's wrong with:
    >>
    >> $l="ça alors: it's a déjà-vu";
    >> print urlencode($l)."<br>\n";
    >> print htmlspecialchars($l);
    >>
    >> Gary
    >
    >
    > I know that, but what is the name of the directory? It
    has to be a real
    > directory name, not a string stored somewhere.
    >
    > What's a valid encoding for a directory named "ça
    alors: it's a
    > déjà-vu"? I can call a folder like this on my
    Mac, but it won't work on
    > any server...
    >
    >
    >
    PS: basically it's not a url encoding issue.
    I can url encode "ça alors: it's a déjà-vu",
    and pass it in a url query string. But my issue is not
    with an url query string, it's with an actual URL, that is,
    the actual name of the directory. It
    can't be "ça alors: it's a déjà-vu". But I
    want to allow the user to name their directory like that
    if they want. So I need a way to encode this into characters
    that can be used for an actual
    directory on the server.
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    Downloads: Slide Show, Directory Browser, Mailing List

  • Can Apple TV display special characters in movie chapter names?

    I have an Apple TV 2.0.1. I have encoded my own movies with descriptive chapter names, imported them into iTunes 7.6.2.9, and synced them to my Apple TV. Does the Apple TV have the ability to display special characters (ó, û, etc.) in movie chapter names? The movies play fine and in iTunes the chapter names are all displayed correctly. I also have an iPod Touch 1.1.4 and it can display the chapter names with special characters fine as well. When playing the movies on Apple TV, only the chapters that have special characters in them display nothing at all for the chapter name. All the other chapters display fine.

    Welcome to the  Discussion Forums.
    I can't really confirm your observation one way or the other, I don't use chapter names. I suspect though that your observations are correct. Unusual characters can often cause issues in a variety of ways, illegal characters in your filenames for example can cause the video not to be found at all or in some cases simply not play. If you are using ie instead of safari for example the  in my welcome my well not display properly whereas others will clearly see it as an apple symbol.

  • Special characters in joins name and Identifiers

    I am working on a business area which was created a time ago. Joins name contain special characters. Regarding Oracle, these are not going to be accepted in the new versions.
    How can I fix this problem, knowing any change in joins name will affect the workbooks.

    You can - and should - double check this, but I believe changing the name only of the join will not cause a problem per se.
    It's when you change the name AND the identifier in one fell swoop that a problem will occur.
    That's because when Disco opens up a workbook, it will look for the name OR identifier (if, for example, the name was changed).
    So, in theory, you could change the name of a join, folder, etc. and then open all your Discoverer workbooks and then save them again. Now they will have knowledge of the new name.
    Then if you wanted - and ALL workbooks were already run and re-saved - you could change the identifier and do the whole process over again.
    So, to summarize, I believe that just changing the actual join name ONLY will not cause any problem.
    Russ

Maybe you are looking for