Oracle's solution for this need for specific research.

Hello

We are on Oracle 11.2.0.2 on Solaris 10. We need to be able to search on data that have diacritics and we should be able to make the serach ignoring this diacritical. That is the requirement. Now, I could hear that Oracle Text has a preference called BASIC_LEXER which can ignore diacritics and so only this feature I implemented Oracle Text and just for this DIACRITIC search and no other need.

I mean I put up preferably like this:
  ctxsys.ctx_ddl.create_preference ('cust_lexer', 'BASIC_LEXER');
  ctxsys.ctx_ddl.set_attribute ('cust_lexer', 'base_letter', 'YES'); -- removes diacritics


With this I set up like this:

CREATE TABLE TEXT_TEST
(
  NAME  VARCHAR2(255 BYTE)
);

--created Oracle Text index

CREATE INDEX TEXT_TEST_IDX1 ON TEXT_TEST
(NAME)
INDEXTYPE IS CTXSYS.CONTEXT
PARAMETERS('LEXER cust_lexer WORDLIST cust_wl SYNC (ON COMMIT)');
--sample data to illustrate the problem

Insert into TEXT_TEST
   (NAME)
 Values
   ('muller');
Insert into TEXT_TEST
   (NAME)
 Values
   ('müller');
Insert into TEXT_TEST
   (NAME)
 Values
   ('MULLER');
Insert into TEXT_TEST
   (NAME)
 Values
   ('MÜLLER');
Insert into TEXT_TEST
   (NAME)
 Values
   ('PAUL HERNANDEZ');
Insert into TEXT_TEST
   (NAME)
 Values
   ('CHRISTOPHER Phil');
COMMIT;

--Now there is an alternative solution that is there,  instead of thee Oracle Text which is just a plain function given below (and it seems to work neat for my simple need of removing diacritical characters effect in search)
--I need to evaluate which is better given my specific needs -the function below or Oracle Text.

CREATE OR REPLACE FUNCTION remove_dia(p_value IN VARCHAR2, p_doUpper IN VARCHAR2 := 'Y')
RETURN VARCHAR2 DETERMINISTIC
IS
OUTPUT_STR VARCHAR2(4000);
begin
IF (p_doUpper = 'Y') THEN
   OUTPUT_STR := UPPER(p_value);
ELSE
   OUTPUT_STR := p_value;
END IF;

OUTPUT_STR := TRANSLATE(OUTPUT_STR,'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'AAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');

RETURN (OUTPUT_STR);
end;
/



--now I query for which name stats with  a P%:
--Below query gets me unexpected result of one row as I am using Oracle Text where each word is parsed for search using CONTAINS...
SQL> select * from text_test where contains(name,'P%')>0;

NAME
--------------------------------------------------------------------------------
PAUL HERNANDEZ
CHRISTOPHER Phil

--Below query gets me the right and expected result of one row...
SQL> select * from text_test where name like 'P%';

NAME
--------------------------------------------------------------------------------
PAUL HERNANDEZ


--Below query gets me the right and expected result of one row...
SQL>  select * from text_test where remove_dia(name) like remove_dia('P%');

NAME
--------------------------------------------------------------------------------
PAUL HERNANDEZ
My need any only had to be able to do a search that ignores diacritical characters. To implement Oracle Text for this reason, I was wondering if it was the right choice! More when I find now that the functionality of the TYPE is not available in Oracle Text - Oracle text search are based on chips, or words, and they differ from the exit of the LIKE operator. So, maybe I just used a simple like function below and used that for my purpose instead of using Oracle Text:

Just this feature (remove_dia) removes diacritical characters and maybe for my need is all what is needed. Can anyone help to revisit that given my need I better do not use Oracle text? I need to continue to use the feature of as operator and also need to bypass the diacritics so the simple function that I satisfied my need while Oracle Text causes a change in the behavior of search queries.

Thank you
OrauserN

If what you need is AS feature and you do not have one of the features of Oracle complex search text, then I would not use Oracle Text. I would create an index based on a function on your name column that uses your function that removes diacritical marks, so that your searches will be faster. Please see the demo below.

SCOTT@orcl_11gR2> CREATE TABLE TEXT_TEST
  2    (NAME  VARCHAR2(255 BYTE))
  3  /

Table created.

SCOTT@orcl_11gR2> Insert all
  2  into TEXT_TEST (NAME) Values ('muller')
  3  into TEXT_TEST (NAME) Values ('müller')
  4  into TEXT_TEST (NAME) Values ('MULLER')
  5  into TEXT_TEST (NAME) Values ('MÜLLER')
  6  into TEXT_TEST (NAME) Values ('PAUL HERNANDEZ')
  7  into TEXT_TEST (NAME) Values ('CHRISTOPHER Phil')
  8  select * from dual
  9  /

6 rows created.

SCOTT@orcl_11gR2> CREATE OR REPLACE FUNCTION remove_dia
  2    (p_value   IN VARCHAR2,
  3       p_doUpper IN VARCHAR2 := 'Y')
  4    RETURN VARCHAR2 DETERMINISTIC
  5  IS
  6    OUTPUT_STR VARCHAR2(4000);
  7  begin
  8    IF (p_doUpper = 'Y') THEN
  9        OUTPUT_STR := UPPER(p_value);
 10    ELSE
 11        OUTPUT_STR := p_value;
 12    END IF;
 13    RETURN
 14        TRANSLATE
 15          (OUTPUT_STR,
 16           'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ',
 17           'AAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
 18  end;
 19  /

Function created.

SCOTT@orcl_11gR2> show errors
No errors.
SCOTT@orcl_11gR2> CREATE INDEX text_test_remove_dia_name
  2  ON text_test (remove_dia (name))
  3  /

Index created.

SCOTT@orcl_11gR2> set autotrace on explain
SCOTT@orcl_11gR2> select * from text_test
  2  where  remove_dia (name) like remove_dia ('mü%')
  3  /

NAME
------------------------------------------------------------------------------------------------------------------------
muller
müller
MULLER
MÜLLER

4 rows selected.

Execution Plan
----------------------------------------------------------
Plan hash value: 3139591283

---------------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name                      | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |                           |     1 |  2131 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| TEXT_TEST                 |     1 |  2131 |     2   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | TEXT_TEST_REMOVE_DIA_NAME |     1 |       |     1   (0)| 00:00:01 |
---------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("SCOTT"."REMOVE_DIA"("NAME") LIKE "REMOVE_DIA"('mü%'))
       filter("SCOTT"."REMOVE_DIA"("NAME") LIKE "REMOVE_DIA"('mü%'))

Note
-----
   - dynamic sampling used for this statement (level=2)

SCOTT@orcl_11gR2> select * from text_test
  2  where  remove_dia (name) like remove_dia ('P%')
  3  /

NAME
------------------------------------------------------------------------------------------------------------------------
PAUL HERNANDEZ

1 row selected.

Execution Plan
----------------------------------------------------------
Plan hash value: 3139591283

---------------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name                      | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |                           |     1 |  2131 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| TEXT_TEST                 |     1 |  2131 |     2   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | TEXT_TEST_REMOVE_DIA_NAME |     1 |       |     1   (0)| 00:00:01 |
---------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("SCOTT"."REMOVE_DIA"("NAME") LIKE "REMOVE_DIA"('P%'))
       filter("SCOTT"."REMOVE_DIA"("NAME") LIKE "REMOVE_DIA"('P%'))

Note
-----
   - dynamic sampling used for this statement (level=2)

SCOTT@orcl_11gR2>

Tags: Database

Similar Questions

  • After the upgrade to windows 10, my dreamweaver has stopped working. Could someone give me a solution for this? I really need DW!

    After the upgrade to windows 10, my dreamweaver has stopped working. It starst and lasts 30 seconds and never work again.

    Could someone give me a solution for this? I really need DW!

    Problems during the installation or opening Dreamweaver on Windows 10

  • I need solution for this...

    Hi all... I am a beginner in blackberry development.

    The code below is every time we click the ok button, it retrieves the content of the

    Saran.txt the SD card file and displays them on the screen. So far so good, but the problem

    is whenever I click on ok again, the content is displayed again. I don't want it to be

    displayed again instead, I want that he should be replaced. I am facing this kind of problem with all areas

    that appears on the screen, that is to say, the second time I click the button only one copy of this field is

    display again.

    can someone suggest a solution for this...

    package myText;
    
    import java.io.*;
    
    import javax.microedition.io.Connector;
    import javax.microedition.io.HttpConnection;
    import javax.microedition.io.file.FileConnection;
    
    import net.rim.device.api.io.transport.ConnectionDescriptor;
    import net.rim.device.api.io.transport.ConnectionFactory;
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.system.EncodedImage;
    import net.rim.device.api.system.PNGEncodedImage;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.*;
    
    public class myText extends UiApplication
    {
        public static void main(String[] args) throws IOException
        {
            myText theApp = new myText();
                theApp.enterEventDispatcher();
        }
        public myText() throws IOException
        {
                new Textdisplay();
        }
    }
    final class Textdisplay implements FieldChangeListener
    {
        MainScreen mainScreen=new MainScreen();
        ButtonField ok=new ButtonField("OK");
        //HttpConnection hc;
        //String url = "http://wordpress.org/extend/plugins/about/readme.txt";
        //InputStream is=null;
        public Textdisplay() throws IOException
        {
            UiApplication.getUiApplication().pushScreen(mainScreen);
            mainScreen.setTitle("Text file Fetching......");
            mainScreen.add(ok);
            ok.setChangeListener(this);
        }
        /*public void downloading() throws IOException
        {
            ConnectionFactory connFact = new ConnectionFactory();
            ConnectionDescriptor connDesc;
            connDesc = connFact.getConnection(url);
            if (connDesc != null)
            {
                HttpConnection httpConn;
                httpConn = (HttpConnection)connDesc.getConnection();
                try
                {
                    final int iResponseCode = httpConn.getResponseCode();
                     Dialog.alert("Response.. code: "+Integer.toString(iResponseCode));
                     mainScreen.add(new LabelField(httpConn.getHost()+"\n"+httpConn.getRequestMethod()));
                     is=httpConn.openInputStream();
                     StringBuffer buffer= new StringBuffer();
                     int chars;
                     while((chars = is.read()) != -1)
                     {
                        buffer.append((char) chars);
                     }
                     String text = new String(buffer);
                     mainScreen.add(new LabelField(text));
                 }
                 catch (IOException e)
                 {
                   System.err.println("Caught IOException: "
                        + e.getMessage());
                 }
            }
        }
        */
        public void Fetching() throws IOException
        {
            String path = "file:///SDCard/BlackBerry/textfiles/saran.txt";
            FileConnection FileConn=null;
            InputStream is=null;
            TextField label = null;
    
            int chars;
    
            Dialog.alert("entering");
            try{
                FileConn = (FileConnection) Connector.open(path,Connector.READ);
                Dialog.alert("file connection");
                if(!FileConn.exists()){
                    FileConn.create();
                }
                Dialog.alert("connection created");
                //int length = (int) FileConn.fileSize();
                //byte[] data = new byte[length];
                is = FileConn.openInputStream();
                //dis.readFully(data);
                Dialog.alert("not yet");
                StringBuffer buffer= new StringBuffer();
                while((chars = is.read()) != -1)
                 {
                    buffer.append((char) chars);
                 }
                 String text = new String(buffer);
                 Dialog.alert("Click to read data.......");
                 label.setText(text);
                mainScreen.add(label);
                is.close();
            }
            catch(Exception e){
                System.out.println("file not found:" + e);
                Dialog.alert("file not found"+e);
            } finally {
                try{ FileConn.close(); } catch(Exception e){}
            }
        }
        public void fieldChanged(Field f, int context)
        {
            try
            {
                //Dialog.alert("Fetching the file.......");
                mainScreen.add(new LabelField("Fetching the data..........."));
                Fetching();
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }
    

    In your current code, ButtonField 'ok' is global, so you can refer to this anywhere.  Add a BitmapField which is overall too.  And then in your transformation, set this to the new Bitmap that you created and invalidate the screen (mainScreen.invalidate ()).

    If you add a BitmapField and it doesn't have a bitmap, it will not display.

  • Need the best solution for the special case

    My version of oracle is 11.2.0

    My name of the table is nitkhush and have a column named long_string of long data type

    The values of the tables are

    LONG_STRING

    Vincent
    Murali
    Bharath
    Nitesh
    Perron
    Married


    I know its not appropriate to use the long type, but again I want to understand the concept, so I've used and should
    output is


    Vincent Kumar
    Murali Kumar
    Bharath Kumar
    Nitesh Kumar
    Perron Kumar
    Married Kumar


    I tried this query
    Select 'Kumar ' | long_string nitkhush but error is ORA-00932: inconsistent data types: expected NUMBER got LONG so I tried to convert in varchar2 pl/SQL

    DECLARE
    LONG temp_long;
    temp_var VARCHAR2 (4000);
    BEGIN
    SELECT 'Kumar ' | long_string
    IN temp_long
    OF nitkhush;

    temp_var: = SUBSTR (temp_long, 1, 4000);
    Dbms_output.put_line (temp_var);
    END;

    but still unable to do as I thought store at length and then using SUBSTR function it will convert and store it in a variable of type varchar2 data but it does not, and according to my knowledge CAST do not long support for the conversion of varchar2 so someone can give me best solution but I need complex queries wholesale as it should be as short as simple to understand so that all the world can understand it easily... And also through the procedure, I tried so that execution of the procedure but still unable to... I tried throgh procedure also all as written above...
    Thank you
    Nitesh Perron.

    If you have to / want to change the default value of a column, you should not update the system tables but use an alter table command
    And by the way, it works

    begin
      for r_col in ( select *
                     from user_tab_columns
                     where table_name = 'MY_TABLE'
                     and data_default is not null
                   )
      loop
        dbms_output.put_line( r_col.data_default || 'Anton' );
      end loop;
    end;
    
  • Need solution for details of error below:-blue screen error BCCode 1000008e + BCP1:80000003 + BCP2:817855 A 8 + BCP3:8B9B9A54 + BCP4:00000000 + OS version: 6_0_6001

    get this problem in win 2 k 8 32-bit enterprose

    Need solution for the details of the error below: -.
    Blue screen error BCCode 1000008e + BCP1:80000003 + BCP2:817855 A 8 + BCP3:8B9B9A54 + BCP4:00000000 + OS version: 6_0_6001

    Hi SudhaArunachalam,

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the TechNet Windows Server forum.

    http://social.technet.Microsoft.com/forums/en/category/WindowsServer/

  • I have a toshiba laptop purchased recently. After the scheduled updates it does not recognize the wireless network. I have to do a system restore. is there a solution for this problem?

    I have a toshiba laptop purchased recently.  After the scheduled updates it does not recognize the wireless network. I have to do a system restore.  is there a solution for this problem?

    Hello

    Make sure you have the latest network adapter drivers fron toshiba

    http://www.CSD.Toshiba.com/cgi-bin/TAIS/support/JSP/home.jsp

    and if windows update is at the origin of the problem change how to get updates to uncover the problem update

    When you have found the issue, a right click on it then invited uac then hide

    read the information on the link below

    http://www.bleepingcomputer.com/tutorials/tutorial140.html

    Download updates but let me choose whether to install them - if you select this option, Windows will download the updates on your computer, but not install them automatically. If you want to install updates, then you must install them manually. You should only select this option if you have a reason to not install updates automatically. Only advanced users should use this option.

    Check for updates but let me choose whether to download and install them - if you select this option, you'll be alerted when there are new updates available for download and install. You can then choose to download and install the updates that you want. This option should really be reserved for people who know exactly which updates they need, or those who have little access to the Internet.

  • Oracle Developer Tools for Visual Studio needs an Oracle Client for the Windows Installation?

    Hi everyone, I need to know if Oracle Developer Tools for Visual Studio is in need of a customer Oracle for Windows installed

    Thanks for your time

    Yes, you have the Oracle Client. However, you don't need to install the Oracle Client separately. ODT automatically includes the Oracle customer in each ODAC installation.

    The next version of the ODAC have an ODT version that uses ODP.NET, successful pilot. This version is not longer an Oracle Client.

  • I have a 4TB vdisk and it occupies space is 2 TB and the remaining space is free but it is very slow, what could be the possible reasons and give the solution for this.

    I have a 4TB vdisk and it occupies space is 2 TB and the remaining space is free but it is very slow, what could be the possible reasons and give the solution for this

    Assuming that you are talking about disk space from in the guest OS. You are probably using an MBR partition table, which limits the maximum usable disk space to ~ 2 TB. In order to use the entire disk space, you need a GPT partition table.

    André

  • Known problem is there a solution for this?

    I get this message when trying to open Photoshop CS4.

    Fatal error - component missing

    / Library/Application Support/Adobe/Adobe Version Cue CS4/Client/4.0.0/VersionCue.framework

    Is there a solution for this problem? Now CS4 is not usable

    Hello

    You just need to re - install again.

    Here is the link to download the CS4 products: https://helpx.adobe.com/creative-suite/kb/cs4-product-downloads.html

    Concerning

    Jitendra

  • Can I use external links to my pictures? BC supports this feature? If so, please give me a solution for this.

    Can I use external links to my pictures? BC supports this feature? If so, please give me a solution for this.

    There is no need to make several posts on this.

    First you must understand how the web works. When you visit a website, your computer downloads the images, it's cache, it stores images, load the images and presents them. This is the basic concept.

    All Web sites can incorporate an image from another website, including BC.
    What you say does not concern if you can hotlink on BC or not... That is until you are actually doing. You mention a CSV file so that you have a web application with custom image and by the CSV field putting external URLS?

    What is an example of the url you put in? -C' maybe is incorect or in a bad way

    What is the configuration of the layout of the web application? -It can not do it in a way to manage the external URL...

    There are several things that could be wrong, then you really need to expand on things, please.

  • What is the best solution for this idea...

    I have a task I'm trying to test and understand what would be the best solution for this, any recommendations would be appreciated.

    Devices at your fingertips:

    -2 ESXi hosts

    -1 iSCSI SAN OpenFiler (new just installed the app)

    2 ESXi hosts run a small amount of virtual machines that are all in the same domain.  I want to have a file server (or a repository somewhere) that houses a folder with easily accessible software (OS, Office, etc.) on the field.

    According to me, that if I made a virtual machine with a large hard drive and share the software, this would not be the best way because it would be dependent on the OS.  Someone has talked about doing a separte VMDK for it and then install it on the operating system on the virtual machine. This way I could always remove the and mount it somewhere else.

    It seems a bit weird to me that the software within this "shared folder" will also be sitting on the data store (if I create a virtual machine and need to use the OS/etc).  Not that doubles the space for the same software (in the comments, then the data store)?

    What is the best approach to make this action which can be accessed at the prompt (mostly windows) in the field?

    What is the best way to stay away the software doubles in action and on the data store?

    Please forgive me if I put interpereted your question.

    The problem you seem to face is that you must mount the ISOs of VMS software and physical systems that are on the field.

    (please, correct me if I'm wrong on this)

    If this is the case, then the best way to do would be to create sharing NFS on the openfiler, if you use openfiler to main databases also then he would be better for sharing this was separated to prevent the other help to be able to tamper with the VMDK and VMX files for your virtual machines.

    This could then be mounted in ESX to access the ISOs. While being easy to install on Linux and Windows machines to access the ISOs.

    If you have questions about NFS mounting in windows, so, this link may help

    http://sagehacks.WordPress.com/2009/01/21/HOWTO-mount-NFS-shares-under-Windows-7

    If you are needing to access the VMs software and it is mainly the downloading ISOs then th ISO directly to the data store is possible.

    This allows you to use ESX to mount the ISO on the virtual machine.

    On the point that the software will use double disk space when you install the software on a machine virtual car will be on the network share and the VMDK virtual machines in the data store. That's right, and that's by design.

    Each virtual machine under ESXI is 'independent' (http://www.vmware.com/virtualization/virtual-machine.html)

    This means that each virtual computer must have its own copy of the application.

    This perspective reflection of each virtual machine as a separate system of 'physical '. They interact with each other as if they were physical systems.

    Each VMDK resembles a physical hard disk. Being accessible (in most configurations) 1 VM at a time.

    So if you had a set of physical systems connected to a domain and I wanted to install an application on each one, then each would have its own local copy of the application. It's the same thing with virtual machines.

    However

    If you configure a set of physical machines so that you run the software from a network share. It is possible to do the same thing using virtual machines using the exactly the same configuration. However, the chiefs more associated to this are important in both cases.

    Concerning

    Cyclooctane

  • May we all find a solution to this problem [ID CC 2014 has stopped working] for this file {included link}

    Hi all

    May we all find a solution to this problem [ID CC 2014 has stopped working] for this file {Dropbox - Questions CH-5 .indd}

    Note: I could open it, but suddenly I encountered this problem with just this file without any of my files.

    Thanks for your help.

    Try the blind of export to the script .idml to Adobe Community: InDesign 6 crashes when you try to open a specific document. All others are open OK.

  • By dictating the long notes, using Siri, Siri will stop as soon as I take a little break. Therefore, the note ends abruptly. Any solution for this?

    By dictating the long notes on Mac using Siri, Siri will stop as soon as I take a little break. Therefore, the note ends abruptly. Any solution for this?

    For long notes, you are better to use regular old dictation - under Mac OS for a few years now, Siri is not mandatory.

    To activate it, go to "System Preferences"-> keyboard-> dictation. Once enabled, you can press the "Fn" key twice to activate and dictate the long notes in any application.

    Siri is optimized for short, quick things. I don't think that you can change, you just use the method that is better to listen to what you want to do at the time (short notes, using Siri. Long notes, use dictation).

  • I'm having issues get notifications on my iPhone and my Apple Watch. Anyone know of a solution for this?

    I'm having issues get notifications on my iPhone and my Apple Watch. Anyone know of a solution for this?

    Difficulty what for? What "issues" are you having?

  • Hi all OneHow can you buy an IBook UK not available in Indian store a store; When you change the status of your country, your billing information and credit cards won't work; is there a solution for this using the same method of billing.

    Hello world

    How can buy you an IBook of UK not available in Indian store a store; When you change the status of your country, your billing information and credit cards won't work; is there a solution for this using the same method of billing

    There is no solution, if it is not available in your area, you can't buy it.

Maybe you are looking for