Case Insensitive Search coupled with "LIKE" operator.

Greetings All, I am running Oracle 11gR1 RAC patchet 25 on Windows X64.
This db supports and application that requires case insensitive searches.
Because there are a few entry points into the db I created an "after login" trigger:
CREATE OR REPLACE TRIGGER MyAppAfterLogon_TRGR
AFTER LOGON
ON DATABASE
DECLARE
vDDL VARCHAR2(200) := 'alter session set nls_comp=''linguistic''';
vDDL2 VARCHAR2(200) := 'alter session set nls_sort=''binary_ci''';
BEGIN
IF ((USER = 'MyAppUSER') OR(USER = 'MyAppREPORTINGUSER')) THEN
EXECUTE IMMEDIATE vDDL;
EXECUTE IMMEDIATE vDDL2;
END IF;
END MyAppAfterLogon_TRGR;
This ensures that everyone connecting to the DB via any mechanism will automatically have case insensitive searches.
Now, to optimize the know queries I created the standard index to support normal matching queries:
select * from MyTable where Name = 'STEVE';
The index looks like:
CREATE INDEX "CONTACT_IDX3 ON MYTABLE (NLSSORT("NAME",'nls_sort=''BINARY_CI'''))
This all works fine, no issues.
The problem is when I write a query that uses the "LIKE" operator:
select * from MyTable where Name like 'STEV%';
I get back the record set I expect. However, my index is not used? I can't for the life of me get this query to use an index.
The table has about 600,000 rows and I have run gather schema stats.
Does anyone know of any issues with case insensitive searches and the "LIKE" clause?
Any and all help would be appreciated.
L

I think there is issue with your logon trigger :
"IF ((USER = 'MyAppUSER') OR(USER = 'MyAppREPORTINGUSER')) THEN"
it should be :
IF UPPER(USER) = 'MYAPPUSER' OR UPPER(USER) = 'MYAPPREPORTINGUSER' THEN
because user name stored in Upper case. Check and try.
HTH
Girish Sharma

Similar Messages

  • Case-insensitive Search with Search Form

    I am using a Search Form with a UIX Page. One of the issue that need to be resolved is to be able to do case-insensitive search for text information stored in some database columns. Please advise me how to implement case_insensitive search with JDeveloper's Search Form.
    Thanks in advance,

    Hi Qian,
    This article (below) by Steve Muench explains how you can customize Query by example behaviour of ADF BCs and if you really want, how to create your own ViewCriteriaAdapter (but you don't have to go quite that far - luckily :) ).
    http://radio.weblogs.com/0118231/2005/02/10.html#a492
    Here is what I did. I implemented the following method in my base view object class (MyBaseViewObject). Note that this code is based on a piece of code that Steve posted on his blog (http://radio.weblogs.com/0118231/stories/2003/07/11/implementingAViewCriteriaAdapterToCustomizeQueryByExampleFunctionality.html); originally an example about creating your own ViewCriteriaAdapter.
    Since applyViewCriteria(oracle.jbo.ViewCriteria) is used by the query-by-example mechanism you're able to "intercept" the ViewCriteria on "it's way in". After that the standard ViewCriteria does it's job as ususal and generated the where clause when required.
    public void applyViewCriteria(ViewCriteria vc)
         if( null == vc || vc.size() == 0 ) super.applyViewCriteria(vc);
         ViewCriteriaRow criteriaRow = (ViewCriteriaRow)vc.first();
         StructureDef def = criteriaRow.getStructureDef();
         AttributeDef[] attrs = def.getAttributeDefs();
         System.out.println(getClass().getName() + ": applyViewCriteria()");
         boolean bFirst = true;
         do{
           if(vc.hasNext() && !bFirst) criteriaRow = (ViewCriteriaRow)vc.next();
           criteriaRow.setUpperColumns(true);
           for (int j = 0, attrCt = attrs.length; j < attrCt; j++)
             String criteriaAttrVal = ((String)criteriaRow.getAttribute(j));
             if (criteriaAttrVal != null && !criteriaAttrVal.equals("") && !JboTypeMap.isNumericType(attrs[j].getSQLType()))
              criteriaRow.setAttribute(j,criteriaAttrVal.toUpperCase());
           bFirst=false;
         }while(vc.hasNext());
         super.applyViewCriteria(vc);
    NOTE that doing this makes all your views case insensitive (to vc search) you may want to implement more functionality in your base view object to set whether a view is in case insensitive mode or not.
    ALSO that flag will not be passivated (if I remember correctly - someone correct me if I'm wrong) so you'll have to add that flag to the passivated data.
    Cheers!
    Sacha

  • Possible to do case-insensitive searches?

    G'day,
    I was wondering if it's possible to do case-insensitive searches in oracle/HTMLDB?
    I've tried what I thought would work
    "select * from application where name like '%microsoft%'", this unfortunately doesn't return any records with a capital in it(eg "Microsoft").
    If there is no way to do case-insensitive searches what is the best way around it?
    Thanks
    -Colin

    Colin,
    Yes it is possible to do case insensitive searches using SQL. Try, for example:
    select * from application where upper(name) like '%ORACLE%'
    The trick is to upper() both sides of the like operator.
    Sergio

  • Case insensitive search and "IN" Clause in Open SQL

    Hi,
    I have some doubts regarding Open SQL:
    - Is there any support for Case Insensitive Search in Open SQL, is it availabe by default?
    - Is there any restriction on number of elements in "IN" Clause, in Open SQL, is there any default number?
    I have checked the [Open SQL Grammer |http://help.sap.com/saphelp_nwce711/helpdata/en/9b/f46cabaa874bc9a82234e8cf1d0696/frameset.htm]also, but nothing found there.
    Thanks,
    Piyush
    P.S I didn't find any other appropriate place to post this thread, let me know the correct categorization of Open SQL in case its wrong.

    > I have some doubts regarding Open SQL:
    I believe that you've questions and not doubts...
    > - Is there any support for Case Insensitive Search in Open SQL, is it availabe by default?
    Nope, there is nothing like that. By default all supported database use a bytewise equal operator - case insensitivness needs to be programmed by hand.
    E.G. using UPPER(x)/LOWER(x) functions.
    Be aware that this disables the possibilities of index usage.
    > - Is there any restriction on number of elements in "IN" Clause, in Open SQL, is there any default number?
    Yes, there is a restriction and it differes between the different DBMS.
    Until recently you could have 2000 variables per statement with MaxDB.
    The current versions of DBSL and MaxDB Kernel now support up to 10000 variables per statement.
    Anyhow, in most cases, such a long in list can and should be avoided by using the FOR ALL ENTRIES construct. With this, the DBSL automatically splits the long IN list into smaller chunks and executes the statements several times.
    This is invisible to the ABAP report - it just gets the result set as usual.
    > P.S I didn't find any other appropriate place to post this thread, let me know the correct categorization of Open SQL in case its wrong.
    I guess in anyone of the DB forums is Ok.
    regards,
    Lars

  • IPM 11g case insensitive searching

    Is it possible in IPM 11g (11.1.1.5) to do an case insensitive search?
    For example, setting the operator to Begins with and enter "And" would return Anderson, Andersons, and Andreeson. But if searching on "and" we get nothing. I would like to be able to search 'and' and return Anderson, Andersons, Andreeson, apple, a-team, etc.

    FYI... Oracle has confirmed that IPM is case SENSITIVE only. Maybe a feature patch or 12g will address this.

  • Doing case insensitive search

    Is there any performant way to do case insensitive searches within the database other than using upper on the column?
    If I use upper(col name) the index on the column is bypassed and hence this effects performance.
    Is there any other way to do this.
    Thanks
    Vandana

    In 10g rel.2 :
    alter session set nls_comp=linguistic;
    Execute your query; it should work for text search case insensitive
    You can also use regular expression function like regexp_like() with match_option set to ‘i’:
    select ename
    from emp
    where regexp_like(ename, ‘k’, ’i’);
    Best Regards
    Krystian Zieja / mob

  • GetOrdinal of AseDataReader Class is not doing case-insensitive search

    hi,
    I am working on 12.5.4 version of sybase ASE.I am using 'Sybase.AdoNet2.AseClient.dll' to connect with database. I am using GetOrdinal method of ASEDatareader class (that as per documentation performs a case-sensitive lookup first. If it fails , a second search that is case-insensitive occurs) but in my case it is not performing case-insensitive search. I am attaching the document for your reference.
    http://infocenter.sybase.com/help/index.jsp?topic=/com.infocenter.dc20066.1570100/doc/html/san1364409576274.html
    Thanks,
    Raman

    Hi Monica,
    Another thing you want to make sure is on your ASE that the oledb/adonet MDA scripts are up to snuff. Some of our fixes in the driver are in this.
    If you login into the ASE and get the output of sp_version.
    You should get something like this:
    OLEDB MDA Scripts
             15.7.0.1250.1013/Wed Feb 19 UTC 00:28:47 2014
    The ado.net driver and the older oledb driver use some specific MDA scripts on the ASE.
    Read the coverletter of the SDK (Software Developers Kit for ASE). It explains how to update the MDA scripts. They are on the client side $sybase\ADONET\sp.
    So where you downloaded the SDK you want to click Info then look for the README.
    This is all the SDKs:
    * Updating the metadata stored procedures required by ODBC, OLE DB and
      jConnect Drivers on Adaptive Server Enterprise
      Certain new features and bug fixes in ODBC, OLE DB and jConnect drivers
      require you to modify the metadata stored procedures in Adaptive Server.
      These stored procedures may not be up-to-date on your host ASE server due
      to various reasons.
      If the metadata stored procedures are outdated, you may not be able to use
      some of the fixes that are implemented in this SP/ESD, so you will need to
      manually install the updated metadata stored procedures.
      To update the metadata stored procedures in Adaptive Server, first determine
      the version of the meta-data scripts installed on the ASE. To do so, execute
      the following command:
      sp_version
      go
      The version number of the ODBC, OLE DB and jConnect meta-data scripts will
      be displayed.
      Review the version number column and compare it against the version of the 
      driver being used.
      If the metadata scripts are outdated, the version installed will be older
      than the driver build number or you will encounter one of the following:
      - stored procedure sp_version is not found
      - the stored procedure output does not print a row for the driver
      The updated scripts are included with the drivers and can be installed as
      follows:
      For ODBC & OLE DB:
      - Go the "sp" directory under the ODBC/OLE DB installation directory
      - Execute the install_odbc_sprocs script for the ODBC Driver and
      install_oledb_sprocs script for OLE DB Provider.
      Syntax for using the script is:
            install_[odbc/olebd]_sprocs <ServerName> <username> [<password>]
             where <ServerName> is the name of the Adaptive Server
                 <username> is the username to connect to the server
                 [<password>] is the password the username
                 (don’t supply this for null password)
      For jConnect:
      - Go to the "sp" directory under the jConnect installation directory. Based
      on your host ASE server version, choose the appropriate SQL script.
      - Use isql or another tool of your choice to execute the selected script.
      This will install the current meta-data stored procedures.
    Thanks,
    Dawn

  • Case insensitive search in SE16

    Hello Community,
    We have a Z table which contains the field "filename," containing both upper & lowercase alphanumeric values. 
    I was surprised to find that it is not so easy to perform a case insensitive search against those field values using SE16.
    It would be perfect if:
       1. a search in SE16 for `file.txt` will find the results of all records related to the file "file.txt"
       2. a search in SE16 for `FiLe.TxT` will also find all records related to the file "file.txt"
    Can someone help me to accomplish this ?
    Thanks!
    Keith Helfrich

    Hi everyone,
    The goal is to perform a case insensitive search in SE16.  Is there no way to do this ?
    While there are a variety of work-arounds, for example : it is possible to store all the values in the table in UPPERCASE, these work-arounds do not solve our problem. 
    The values in the table need to be stored with the accurate case, exactly as the file is named at the UNIX level.  Since UNIX is also case sensitive, we need to be accurate with the case when storing statistics data about the files. 
    Yet, when searching in SE16, it is problematic because we don't always know the correct case.  For that reason, a case insensitive search is required.
    This seems to be a very basic function that I am surprised SAP doesn't provide...

  • Case Insensitive search and "IN" Clause - Open SQL

    Hi,
    I have some doubts regarding Open SQL:
    Is there any support for Case Insensitive Search in Open SQL, is it availabe by default?
    Is there any restriction on number of elements in "IN" Clause, in Open SQL, is there any default number?
    I have checked the [Open SQL Grammer|http://help.sap.com/saphelp_nwce711/helpdata/en/9b/f46cabaa874bc9a82234e8cf1d0696/frameset.htm] also, but nothing found there.
    Thanks,
    Piyush
    P.S I didn't find any other appropriate place to post this thread, let me know the correct categorization of Open SQL in case its wrong.

    Is there any support for Case Insensitive Search in Open SQL, is it availabe by default?
    When you are querying any strings, it is always case sensitive.
    Is there any restriction on number of elements in "IN" Clause, in Open SQL, is there any default number?
    I don't think there area any. IN opearator works like combined ORs and here you don't have any restrictions in fields number.
    Regards
    Marcin

  • Case insensitive search working in dev but not in prod

    Hello All,
    I had set the CASE_SENSITIVE_CHARACTER_COMPARISON parameter as OFF in NQSConfig.ini file for enabling the case insensitive search in OBIEE.
    This setup is letting me do the case insensitive search in Dev env but the same doesnt work in prod env. I tried pointing both prod and dev rpd to same prod db.
    With same db also, case insensitive search doesnt work in prod env.
    Any idea for which other configuration I can look for.
    Thanks in advance.

    Thanks Stijin. I had seen this post earlier. Case insensitive search works fine after setting the value for NLS_SORT and NLS_COMP in production RPD but the other report with distinct clause starts failing. Not sure about the reason.
    Saw this comment from you in that post:
    The only compromise solution we could find was to "cache" the column value we wanted to use in insensitive searches. These were mainly used in "show all choices" while setting prompts. Other than that there isn't much you can do in an Oracle database.
    Can you please tell me how to implement the above.

  • Case insensitive search on subject name to retrieve a certificate from key chain.

    Hi,
    I need to find the client certificate from key chain based on the subject name.
    Currently, I am using attribute kSecLabelItemAttr and providing the subject name to create the attribute list for the API "SecKeychainSearchCreateFromAttributes" which gives the certificate.
    Problem: This certificate search is case sensitive for the subject name.
    Question: Is there a way to do a case insensitive search on a subject name to get a certificate on snow leopard? I found the attribute "kSecMatchCaseInsensitive" which works with key "kSecClassCertificate" in the API "SecItemCopyMatching", but the key kSecClassCertificate is only available for 10.7 and later.
    https://developer.apple.com/library/mac/#documentation/Security/Reference/keycha inservices/Reference/reference.html#//apple_ref/doc/uid/TP30000898-CH4g-SW7
    Any help is highly appreciated.
    Thanks!

    I think there is issue with your logon trigger :
    "IF ((USER = 'MyAppUSER') OR(USER = 'MyAppREPORTINGUSER')) THEN"
    it should be :
    IF UPPER(USER) = 'MYAPPUSER' OR UPPER(USER) = 'MYAPPREPORTINGUSER' THEN
    because user name stored in Upper case. Check and try.
    HTH
    Girish Sharma

  • Case-Insensitive Searching on Content Server

    Hello everyone,
    I have a Content Server 10gr3 using an Oracle 11g DB. All of my searches are case sensitive, but we need case-insensitive searching. I've tried changing the DatabasePreserveCase variable in the config.cfg to 1, 0, true, and false, rebuilt the indexes in between each reboot (not sure if that's necessary or not), tried checking in new documents after making the changes and searching for those, but no matter, searches stay case sensitive.
    We have another UCM install running on a 10.2.0.3.0 DB, and case insensitivity works on that Content Server with DatabasePreserveCase=1.
    What could we be doing wrong? I've found several documents which have stated that case-insensitivity is impossible with an Oracle DB, but I think those are all old and from before Oracle's acquisition of the product (and obviously it is possible, since we have another install with it working).
    Thanks in advance for any help you can give!

    I'm not quite sure what you mean by Search Engine... we simply installed the Oracle 11g Database, then installed Content Server and configured it to run using that database. We haven't done anything with full-text search.
    Edit: Do you mean the SearchIndexerEngineName value in the config file? It's DATABASE.METADATA, though at some point we also need to get full-text up and running which to my understanding requires it to be DATABASE.FULLTEXT.
    As to the OracleCaseInsensitiveSearch component, where can I find it? Google shows up nothing, and MetaLink has one page saying that it exists but nothing more...
    Message was edited by:
    user573973

  • SAP JPA - case-insensitive search

    Hi there, is it possible to have a case-insensitive search with SAP JPA? The keywords UPPER, LOWER aren't available in the query (OpenSQL limitation I guess).
    The only way I see is to create a duplicates columns for the search relative atributes and make the data upper or lower case before save. May be there is another options? More suitable and elegant?

    Hi,
    you may bypass openSQL by native queries.
    Make sure that you use the hint described in
    http://help.sap.com/saphelp_nwce72/helpdata/en/4a/0cf02870c540caab611d56220ec0cb/frameset.htm
    together with createNativeQuery.
    But anyway, the approach with duplicates columns enables you to create indexes on these UPPER columns. It is not too bad.
    Regards,
    Rolf

  • Case-insensitive searches on lob

    Hi,
    I work with oracle 10 on linux.
    I have a table with clob.
    I need to do case-insensitive searches on this field.
    How can I do? I can't use upper or lower function.

    Yes, you can :
    SQL> desc PS_RC_SOL_PRODSRCH
    Name                                      Null?    Type
    SETID                                     NOT NULL VARCHAR2(5 CHAR)
    SOLUTION_ID                               NOT NULL NUMBER(15)
    PROD_DESCRLONG                                     CLOB
    SQL> select setid,PROD_DESCRLONG
      2  from   PS_RC_SOL_PRODSRCH
      3  where dbms_lob.instr(lower(PROD_DESCRLONG),'n') > 0
      4  and   rownum<3;
    SETID
    PROD_DESCRLONG
    NLCOM
    |NLC0001|Benefits|
    NLCOM
    |NLC0001|Benefits|Nicolas.

  • Case insensitive searching in Interactive Page

    Hi all,
    I am currently working on the interactive report, and wondering is it possible to perform case insensitive search for the data in the textbox besides the magnifying class.
    By the default, the system uses "=" for searching. I tried the searching option using "contains", and it would be able to search the content in uppercase and lower case scenario. Is it possible to make "contains" as the default?
    Thanks,
    Thomas.

    By the default, the system uses "=" for searching.I get "Row text contains..." as the filter when entering text directly into the default search box. Perhaps you are working with a saved report?
    There's a way to make all IR comparisons case insensitive. See this <a ref="http://apex.oracle.com/pls/otn/f?p=34839:18">example of case/accent insensitive search</a> on a standard report.
    That code can't be put in a Before Regions process as described to work with IRs as page processes are not executed by the AJAX call that refreshes the report. However, IR refreshes do run the Virtual Private Database PL/SQL call defined in the application security attributes, so putting the NLS modification code there will work.
    Go to Application > Shared Components > Edit Security Attribute | Virtual Private Database (VPD), and make the call from there. Due to the specific requirements of the code that has to be called from here when used for security purposes, this is probably best done by setting this up to make separate calls to packages defined outside APEX, one to handle any actual VPD and other security-related details, and others to orchestrate any other code that has to be run. (For example, in this case it may not be desired to alter the NLS environment on every page, so the program could take a parameter specifying the current page and apply the ALTER SESSION conditionally on this.)

Maybe you are looking for

  • Can't mount a folder from a windows network..

    Our "IT" (outsourced) department migrated the network folders to another server and changed the filepath on the one folder I need to mount on my Macbook Pro (OSX 10.6.8). I have been able to mount the new folder onto other Windows boxes succesfully,

  • Sendmail issue on solaris 10

    Hi, I am getting the following logs frequently on my solaris 10 server. Jun 30 16:52:01 <servername> sendmail[20814]: [ID 801593 mail.info] m5UFq10v020814: from=metron, size=536, class=0, nrcpts=1, msgid=<200806301552.m5UFq10v0208 14@<servername>.>,

  • SELECTING  REQUIRED RECORDS FROM TABLE IN SCREEN

    hi experts,                I have created a screen and i have used a table control thru wizard. that table has to show only the current record that i have saved .what to do . thanks mani

  • Subcontract Process in MM

    Hi All, I have to map the following scenario in SAP. There are three materials A, B & C. We send material B to the vendor. Vendor purchases material C. Vendor adds material B to material C and sends us material A. We pay vendor for material C and lab

  • Transport of query

    hi all, When i try to create a transport request for a query a local request is created.which i cannot transport.this query is in standard area.please help me to transport query. thanks , mahesh