Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SQL convert diacritic to anglicized form

Posted on 2011-09-20
6
1,011 Views
Last Modified: 2012-05-12
Hello All,

We need to convert diacritic supplied by the front end to anglicized form to search

For example:

(ÀÖÙãas) to (AOUaas), because the database column we have does not contain diaciritc, so we if user added a diacritic character we need to search with non diacritic form.

Please help

Thank you
0
Comment
Question by:dojjol
  • 4
  • 2
6 Comments
 
LVL 15

Expert Comment

by:x77
ID: 36567870

  S has 6 chars.
  Normalized string has 10 chars. Each diacritic char is decomposed.

  I added all chars from s1 to Sb except NonSpacingMark chars.
Dim s = "ÀÖÙãas"
     Dim s1 = s.Normalize(NormalizationForm.FormD)
     Dim sb As New StringBuilder(s.Length)
     For Each c In s1
         If Char.GetUnicodeCategory(c) = Globalization.UnicodeCategory.NonSpacingMark Then Continue For
         sb.Append(c)
     Next
     Debug.Print(sb.ToString)

Open in new window

0
 

Author Comment

by:dojjol
ID: 36567906
thank x77, is it a stored procedure?
0
 
LVL 15

Expert Comment

by:x77
ID: 36567932
Sorry.

SELECT CONVERT('Ä Ê Í Õ Ø A B C D E','US7ASCII','WE8ISO8859P1')
FROM DUAL;
A E I ? ? A B C D E

0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 15

Expert Comment

by:x77
ID: 36567951
SELECT CONVERT('ÀÖÙãas','US7ASCII') FROM DUAL;    ->AOU?as
0
 

Author Comment

by:dojjol
ID: 36568308
thanks again, but we missed 'Ù' and is replaced as '?' in AOU?as, so not really sure this will work for me
0
 
LVL 15

Accepted Solution

by:
x77 earned 500 total points
ID: 36568574
Yes, I see on my machine that "Õ" Translates to ?, But I am work with Spanish.

You can try a char_set_from that contains this leter.
http://www.techonthenet.com/oracle/functions/convert.php

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question