Like Query with Case insensitive

Hi ,
I have select query with Like, need to add case insenstive for that.
E.g
Select * from emp where empname like ('D%').
The above query will fetch only names starting with 'D' not the name starting with 'd'.But i need to fetch all the name starting with D or d. Can anyone help me out with this query.
Thanks
Durai

Hi
Use uppercase for example:
Select * from emp where upper(empname) like ('D%');
Ott Karesz
http://www.trendo-kft.hu

Similar Messages

  • Intermittent oracle errors with case-insensitive searches

    Hi
    I have a table with several columns, two of them are indexed with oracle text.
    When I ask queries containing "CONTAINS"-clauses against these columns everything works great. However I have a few other columns in table that I want to run case-insensitive comparisons with.
    So I enable case-insensitivity:
    ALTER SESSION SET NLS_COMP=LINGUISTIC
    ALTER SESSION SET NLS_SORT=BINARY_CI
    Now I suddenly start getting intermittent errors.
    When I call a query:
    SELECT
    FROM
    article_table at
    WHERE
    CONTAINS(searchfield , '%MEAT%') > 0
    Sometimes it works, but sometimes I get:
    ERROR
    ORA-29902: ett fel inträffade när rutinen ODCIIndexStart() kördes
    ORA-20000: Oracle Text error:
    DRG-00100: internal error, arguments : [50935],[drpn.c],[1051],[],[]
    DRG-00100: internal error, arguments : [50935],[drpnw.c],[601],[],[]
    DRG-00100: internal error, arguments : [51002],[drwa.c],[594],[],[]
    DRG-00100: internal error, arguments : [51028],[drwaw.c],[297],[0],[%MEAT%]
    DRG-00100: internal error, arguments : [50401],[dreb.c],[1033],[],[]
    ORA-00600: intern felkod, argument: [qernsRowP], [1], [], [], [], [], [], []
    Anyone knows what is going on? Is this bug? Is there a fox for it?
    Thanks for any help anyone can provide.
    /Kjell

    Clearly that's a bug. Unless anyone here recognizes it and can point you to the bug/patch number I would strongly recomend you to take it to oracle support.
    Incidently, doing a search for '%MEAT%' is usually a bad idea. Leading wildcards will disable the use of the index on the $I table, so unless you're using the SUBSTRING_INDEX option such searches will usually perform very badly. They shouldn't cause "internal errors", of course.

  • Mapping with case insensitivity in Filter operator expression

    I need to import data from an ODS into DW table.
    How can I set this before a certain mapping is run to make it case insensitive?
    execute immediate 'alter session set NLS_SORT=BINARY_CI';
    execute immediate 'alter session set NLS_COMP=LINGUISTIC';
    Thanks,
    JGP

    Hi,
    Use upper(column) in the filter expression.
    Regards
    Bharath

  • Jbo:DataQuery with case insensitive search

    I'm working on a BC4J JSP project. I cannot find a way to search in the case insensitive mode. I'm using JDeveloper 9.0.3.1. I looked in the DataQueryComponent.jsp, the xxxx_Query.jsp, and all the files generated under the ViewObject to find a way to accomplish this but no luck. Please advise. Thank you.

    For those who e-mailed me about this question and you who are searching an answer for this question, here is the solution.
    I added some codes in DataQueryComponent.jsp. I put the following codes right after the closing of the "Add Criteria" jbo:OnEvent. It works for me and it will work for you.
    <jbo:OnEvent name="Search" >
    <% String rowParam = params.getParameter("nRows");
    int nCriteria = 0;
    if (rowParam != null)
    try {
    nCriteria = Integer.parseInt(rowParam);
    catch (Exception ex) { }
    %>
    <jbo:ViewCriteria id="vc" datasource="ds" action="new">
    <% for (int i=0; i < nCriteria-1; i++)
    { %>
    <jbo:CriteriaRow id="row<%=i%>" uppercolumns="true">
    <jbo:AttributeIterate id="attrvc" datasource="ds" queriableonly="true">
    <% String item = attrvc.getName();
    String value = params.getParameter("row" + i + "_" + item);
    value = value.toUpperCase(); %>
    <jbo:Criteria dataitem="<%=item%>" value="<%=value%>" />
    </jbo:AttributeIterate>
    </jbo:CriteriaRow>
    <%
    %>
    </jbo:ViewCriteria>
    </jbo:OnEvent>

  • Update query with case

    my table : workingdate
    sno name startdate
    1 ss 1-12-2011
    2 bb 1-11-2011
    I can update name or start date or both .i will pass new date,name to update through front end.
    I need to validate the condition in case statement i.e. when the new date passed check whether it is greater then start date. if it is greater then it should update with new start date.
    if no then it should be update it will old value.
    i using below query
    update workingdate set name='sss',startdate=(
    case
    when
    (TO_DATE('2011-12-10','yyyy-MM-dd') > (select TO_DATE(startdate,'yyyy-MM-dd') from workingdate where sno=1))
    then TO_DATE('2011-12-10','yyyy-MM-dd')
    else
    select TO_DATE(start_date,'yyyy-MM-dd') from workingdate where sno=1
    end
    where sno=1;
    but when i execute the above query it shows me
    Error report:
    SQL Error: ORA-00936: missing expression
    00936. 00000 - "missing expression"
    *Cause:   
    *Action:
    how could i resolve this.......................

    Check this out
    UPDATE workingdate
    SET NAME='sss',
         startdate=(CASE WHEN (TO_DATE('2011-12-10','yyyy-MM-dd') > startdate THEN TO_DATE('2011-12-10','yyyy-MM-dd') ELSE start_date END)
    WHERE sno=1;Cheers
    Kanchana

  • Help on converting query with case into decode

    Hi Can anyone help me to revise my plsql query? Below is a portion og the procedure I am changing to meet Oracle 8i.
    SELECT SUM(NVL(CASE WHEN (weeks='wk1' ) THEN qty END, 0)) wk1,
    SUM(NVL(CASE WHEN (weeks='wk2' ) THEN qty END, 0)) wk2,
    SUM(NVL(CASE WHEN (weeks='wk3' ) THEN qty END, 0)) wk3,
    SUM(NVL(CASE WHEN (weeks='wk4' ) THEN qty END, 0)) wk4
    FROM TABLE1
    Thanks in advance.

    pls try this....(code not tested as no create table etc provided).
    select dt
    from (select decode(is_tbd,
    'yes',
    decode(is_tbd_order,
    'no',
    'tbd',
    decode(sign(ex_fac_date - (v_asofdate + 131)),
    1,
    'tbd',
    null),
    decode(sign(ex_fac_date - (v_asofdate + 131)),
    1,
    'tbd',
    null)),
    null) dt
    from dual
    union all
    select decode(sign(ex_fac_date - (v_asofdate - 1)),
    1,
    decode(sign(ex_fac_date - (v_asofdate + 5)),
    0,
    decode(is_tbd, 'no', 'wk1', null),
    null),
    null)
    from dual
    union all
    select decode(sign(ex_fac_date - (v_asofdate + 6)),
    1,
    decode(sign(ex_fac_date - (v_asofdate + 12)),
    0,
    decode(is_tbd, 'no', 'wk2', null),
    null),
    null)
    from dual
    select decode(sign(ex_fac_date - (v_asofdate + 13)),
    1,
    decode(sign(ex_fac_date - (v_asofdate + 19)),
    0,
    decode(is_tbd, 'no', 'wk3', null),
    null),
    null)
    from dual
    union all
    select decode(sign(ex_fac_date - (v_asofdate - 1)),
    0,
    decode(is_tbd, 'no', 'past_due', null),
    null)
    from dual
    where dt is not null
    Regards

  • 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

  • Select query case insensitive for data type VARG

    Hi Experts,
    I am having trouble in retrieving the results from a table using select query.
    I have a table (Users) as below
    Name (VARG)        Number(INTEGER)
    Murthy             0001
    murthy             0002
    when I am querying the table with select query as -
    select * from Users where Name = 'Murthy'
    this query is returning only one record which matches with capital letter of 'M', though both the record names are same.
    I have seen in IBM forum to make the select query as case insensitive using the UPPER key word, I have tried this as below -
    select * from Users where UPPER(Name) = 'MURTHY'
    But this query is not working in my case...
    My DB2 version is 8.1.5
    Can any one please help in fixing this problem...
    Thanks in Advance,
    Murthy

    Hi Murthy,
    your query is the right to one to select both records. I don't see why it doesn't work.
    Are you sure you posted the query that you have executed ?
    What is the result of this query ?
    But i don't really know how an VARG (Varying-length graphic string) will work. It could be that the UPPER-Function will work in another way as it works on VARCHAR.
    regards
    Kay

  • Case insensitive query from a JSP

    I am using JDeveloper 3.1 to create JSP applications using the wizard for business components for JSP application.
    The default query screen allows a search to be performed on all the fields on the table (using the Findform web bean).
    How can I change the search such that the query is Case Insensitive ?
    Many Thanks,
    Ketan.
    Many Thanks,
    Ketan.

    Forms is not really instrumented to query clobs directly. Google "oracle forms and clob" to see some suggestions on how to handle clobs in Forms

  • Case sensitive and case insensitive Search

    Hi friends,
         Iam doing an Search RFC which will search records based on the search parameters provided at the portal side.
    One of the search parameter is a field with 40 character which holds the description(title) of the record.
    With this search paramter iam facing case sensitive problem.
    Example:
    Values in Database Table: ( Can be in any case)
           Record 1:  Sensitive
           Record 2:  SENSITIVE
           Record 3:  SensTive
           Record 4:  sensitive
           Record 5:  sensTive
         Input to RFC:  sens*
         Output: Getting only 4rth and 5th record but not all the records.
           The same is the case with the remaining search parameters(Like user name..).
           Is there any way of getting all the records when searching from the data base (with case insensitive).
           Kindly let me know if there is any possibility.
    Thanks in advance.
    Regards,
    Swarna Munukoti.

    Generally, no.  So, you'll either have to use EXEC SQL, or add more fields to the table.  You can do this using APPEND structures, which is the SAP approved way of adding fields.  If there are suitable user exits in the standard SAP code, then you'll be able to populate the additional fields there, as new records are created, or amended.
    Alternatively, create your own Z table with the same key as the standard table and a "search field" which contains the uppercase version of the field you're wanting to search.  You can either, again populate in suitable user exits, or, in worst case, have job that runs regularly populating your Z table.
    matt

  • Case Insensitive filter Feature in InputListOfValues Popup

    Dear all,
    I had taken reference in HRSystem (the tutorial provided by Oracle) ,
    [http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/ria_application/developriaapplication_long.htm]
    In section "Create a Page Flow" Step 19 popup
    You CAN "Search for Jobs whose jobTitle begins with A%. " but
    CANNOT "Search for Jobs whose jobTitle begins with a%. " (Lower case of A, no result returns)
    As we can filter the column with case insensitive by setting the filterfeature="caseInsensitive" in af:column
    I want to use this feature in this InputListOfValues popup.
    Anyone has ideas on that?
    Million Thanks!
    Luis

    Can anyone can give me suggestions?
    Thanks!

  • About regex and 'like' query

    Dear all,
    can i doing regex query in SAP B1?
    And how to use 'like' query with table, i mean :
    SELECT * FROM test T0 INNER JOIN test2 T1
    WHERE T0 LIKE '%T1.testfield%'
    thanks for your help

    wait - something came out funny in the previous posting - the system highlighted the name "field" with blue - that is NOT what I typed...
    instead I typed...
    "field" between two brackets ( bracket = [ and the other bracket - I cannot type them in because they come out as a different character)
    what the heck is going on with the forum here???  I am seeing this highlighting in other postings as well...
    Hope THIS one comes out correctly
    Edited by: Zal Parchem on Dec 29, 2007 2:47 PM

  • Case insensitive selects with 'like'

    I use a 10g database (10.2.0.2 same behaviour with 10.2.0.1). What we want is case insensitive selects with 'like' operator in the where clause. NLS_COMP is set to 'LINGUISTIC' and NLS_SORT is set to 'BINARY_CI.
    In a table we have two columns one of type 'varchar2' one of type 'nvarchar2'. The databases national character set is set to UTF8. Case insensitive sorting works with both columns. Select statements with '.... where varchar2col like '%r%' returns also values with upper case 'R' values (that is what I expect).
    The select statements with '.... where nvarchar2col like '%r%' however does not return the row with upper case 'R' values.
    I used SQL*Plus: Release 10.2.0.3.0 and other clients and the behaviour is the same so
    I think it is not client related.
    Is that a known issue or is there any other parameter to set for UTF8 nvarchar columns?
    Any hint is very much appreciated! Here are the nls settings in database, instance and session:
    DPARAMETER      DVALUE IVALUE SVALUE
    NLS_CHARACTERSET WE8ISO8859P1
    NLS_COMP      BINARY LINGUISTIC LINGUISTIC
    NLS_LANGUAGE      AMERICAN AMERICAN AMERICAN
    NLS_NCHAR_CHARACTERSET UTF8
    NLS_RDBMS_VERSION 10.2.0.1.0
    NLS_SORT BINARY BINARY_CI BINARY_CI
    NLS_TERRITORY      AMERICA AMERICA AMERICA

    OK. Found out what the problem is. It is obviously the client.
    While using the instant client and setting the parameters (NLS_SORT=BINARY_CI and NLS_COMP=LINGUISTIC) as environment variables does not work correctly, at least not for nvarchar2 fields. The nls_session_parameters show the correct values, but selects with 'like' operators in the where clause do not return case insensitive. Issuing the 'alter session' commands and again setting the nls parameters solves the problem.
    Using the full client installation also works, in case the parameters are set in the registry on windows systems. With the full client it it not necessary to issue the 'alter session' commands again.
    So obviously the problem is instant client and nvarchar2 field related. That's too bad....

  • SELECT Query to get the Values in Case insensitive Format

    Hi ,
    This is hari,
    I want to select the user name in a table ex: username="HARI" or username='Hari' or username="HaRi" like this
    If i wrote the query like
    select username from userdb where username="Hari";
    it is displaying the records which only matches "Hari" only .
    can anybody help me out on this query asap please....
    the query should return all the results
    which matches any of the following strings as inputs "HARI" or "HaRi" or "hAri" or the like.
    Awaiting for Response,
    Thanks & Regards
    Hari

    Another solution is setting NLS_SORT to CI - case insensitive (or whatever_your_language_is_CI) and NLS_COMP to ANSI:
    SQL> with t as (
      2             select 'HARI' name from dual union all
      3             select 'Hari' name from dual union all
      4             select 'HaRi' name from dual
      5            )
      6  select  *
      7    from  t
      8    where name = 'hArI'
      9  /
    no rows selected
    SQL> alter session set nls_sort = binary_ci
      2  /
    Session altered.
    SQL> alter session set nls_comp=ansi
      2  /
    Session altered.
    SQL> with t as (
      2             select 'HARI' name from dual union all
      3             select 'Hari' name from dual union all
      4             select 'HaRi' name from dual
      5            )
      6  select  *
      7    from  t
      8    where name = 'hArI'
      9  /
    NAME
    HARI
    Hari
    HaRi
    SQL> SY.

  • Search on text with diacritic, and case insensitive

    Hello to all,
    I'm using this condition in a query on XML:
    field[contains(@value, "gangesa" )
    If @value= 'Gaṅgeśa' I'd like to get this record also by using the word: "gangesa" So I need to map:
    ṅ = n
    ś = s
    And do it in case insensitive. Somebody can help me?
    Thank you,
    Cristian                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    ALTER SESSION SET NLS_COMP=LINGUISTIC;
    ALTER session set nls_sort='binary_ai'; -->accent insensitive
                 binary_ci -->case insensitive.
    with t as
    (select 'Gageśa' col1 from dual union all
    select 'GAgEśa'  from dual union all
    select 'gagEśA'  from dual union all
    select 'not Gageśa' from dual
    select * from t where col1 like '%gagesa';
    Gagesa
    GAgEsa
    gagEsA
    not Gagesaand do the search.
    Edited by: PhoenixBai on Aug 25, 2010 10:14 PM

Maybe you are looking for

  • Error while implementing BADI ME_GUI_PO_CUST

    Hi Experts, My requirment is to add a new tab in ME21N screen.We have to implement the BADI ME_GUI_PO_CUST and methods SUBSCRIBE and MAP_DYNPRO_FIELDS will create a new tab.however i have got a problem in method MAP_DYNPRO_FIELDS. i have defined 2 z

  • Oracle 10g - Data Pump: Export / Import of Sequences ?

    Hello, I'm new to this forum and also to Oracle (Version 10g). Since I could not find an answer to my question, I open this post in hoping to get some help from the experienced users. My question concerns the Data Pump Utility and what happens to seq

  • HT201493 What determines the notify button activation?

    I know the location of two friends but I can be notified when one of them moves but not the other one!

  • Data extraction

    Hi, My requirement is : company requires data to be extracted from diff source systems to 'ONE SOURCE'.One source is used for decision making for enabling best business practices in strategic sourcing,  by providing supply chain visibility into (a) S

  • Randomly missing music/videos

    Just recently I didn't have any proof, but I'd swear that something on the itunes network is deciding that it can't play my legally bought music/dvds, that I have imported to iTunes. These are cd's and things I have purchased elsewhere but have added