Wrong result for query with like and %

I have a strange problem with query with like and %.
When I run this script:
ALTER SESSION SET NLS_SORT = 'BINARY_CI';
ALTER SESSION SET NLS_COMP = 'LINGUISTIC';
-- SELECT * FROM NLS_SESSION_PARAMETERS;
-- drop table test1;
CREATE TABLE TEST1(K1 NVARCHAR2(80));
INSERT INTO TEST1 VALUES ('gsdk');
INSERT INTO TEST1 VALUES ('ąxyz');
INSERT INTO TEST1 VALUES ('ŁFa');
INSERT INTO TEST1 VALUES ('ła');
INSERT INTO TEST1 VALUES ('Śab');
INSERT INTO TEST1 VALUES ('Śrrrb');
commit;
select * from TEST1 where k1 like N'Ł%';
I get this:
K1
ŁFa
ła
Śab <- WRONG
Śrrrb <- WRONG
4 rows selected
When i change datatype to varchar2 this code work correct.
Is this a bug or what ?
The execution plan:
PLAN_TABLE_OUTPUT
SQL_ID d3d64aupz4bb5, child number 2
select * from TEST1 where k1 like N'Ł%'
Plan hash value: 4122059633
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 2 (100)| |
|* 1 | TABLE ACCESS FULL| TEST1 | 1 | 82 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter((NLSSORT("K1",'nls_sort=''BINARY_CI''')>=HEXTORAW('014200'
) AND NLSSORT("K1",'nls_sort=''BINARY_CI''')<HEXTORAW('01610100') ))
Note
- dynamic sampling used for this statement (level=2)

DATABASE NLS CONFIGURATION:
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET     AL16UTF16
NLS_COMP     BINARY
NLS_SORT     BINARY
Oracle version 11.2.0.2.0

Similar Messages

  • Simple query with like return wrong result

    Hi,
    I run simple query with like.
    If I use parameter I get wrong results.
    If I use query without parameter results are ok.
    My script:
    ALTER SESSION SET NLS_SORT=BINARY_CI;
    ALTER SESSION SET NLS_COMP=LINGUISTIC;
    -- drop table abcd;
    create table abcd (col1 varchar2(10));
    INSERT INTO ABCD VALUES ('122222');
    insert into abcd values ('111222');
    SELECT * FROM ABCD WHERE COL1 LIKE :1; -- wrong result with value 12%
    COL1
    122222
    *111222*
    select * from abcd where col1 like '12%'; -- result ok
    COL1
    122222
    I use Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    and query run in Oracle SQL Developer 3.1.07.

    Hi,
    welcome to the forum.
    When you put some code please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    You should specify exactly how you run your code.
    If I run this statement in SQL Plus:SQL> ALTER SESSION SET NLS_SORT=BINARY_CI;
    Session altered.
    SQL> ALTER SESSION SET NLS_COMP=LINGUISTIC;
    Session altered.
    SQL>
    SQL> -- drop table abcd;
    SQL> create table abcd (col1 varchar2(10));
    Table created.
    SQL>
    SQL> INSERT INTO ABCD VALUES ('122222');
    1 row created.
    SQL> insert into abcd values ('111222');
    1 row created.
    SQL>
    SQL> SELECT * FROM ABCD WHERE COL1 LIKE :1;
    SP2-0552: Bind variable "1" not declared.
    SQL>
    I got this error. So I wonder how you set value 12%
    Please specify exactly how you run your test as we cannot reproduce your problem.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Why Apple doesn't provide .jpg-files for photos with date and our like Blackberry and Samsung?

    why Apple doesn't provide .jpg-files for photos with date and our like Blackberry and Samsung?
    I have to save photos (for medical use) on my pc and this suffix would be useful to identify them quicker.
    Thanks

    http://www.learn.usa.canon.com/resources/blogs/2014/20140708_winston_filenames_b log.shtml

  • Content Search Web Part displaying wrong Results for anonymous Users.

    HI Forum Group,
    I am getting Wrong results for my content search web part. The requirement is to show the News Description for the selected news item.
    I have a catalog site which stores News like 
    News1
    News2
    News3
    as Items. and i have connected this catalog in publishing site which is anonymous. In the publishing site created one page "News.aspx"added search results webpart which shows all the news item. Added one page "Description.aspx" to show
    description to show the selected news item.
    When ever user selects any news from news.aspx page it will redirected to description.aspx with the selected item ID
    The "Description.aspx" the search results page gets the data based on the URL by QueryString parameter as shown below
    The problem is, if i multiple items to open in tabs all the items are showing the data same as the first selected item, though the article ID is different.
    Thanks
    Sithender

    Hi,
    Thank you for your feedback on how you were successful in resolving this issue.
    Your solution will benefit many other users, and we really value having you as a Microsoft customer.
    Have a nice day!
    Best Regards,
    Lisa Chen
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • CAML Query with 10 AND conditions

    Hello,
    I need some help with a CAML query. This particular query needs to have 10 AND conditions. Quite frankly, with all the nesting it is driving me a little nuts:
    What I have is:
    <Query>
    <Where>
    <And>
    <And>
    <And>
    <And>
    <And>
    <And>
    <And>
    <And>
    <And>
    <Eq><FieldRef Name='Column1' LookupId='TRUE' /><Value Type='Text'>10341</Value></Eq>
    <Eq><FieldRef Name='Column2' LookupId='TRUE' /><Value Type='Text'>9539</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column3' LookupId='TRUE' /><Value Type='Text'>183</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column4' LookupId='TRUE' /><Value Type='Text'>35</Value></Eq>
    </And>
    <IsNull><FieldRef Name='Column5' /></IsNull>
    </And>
    <Eq><FieldRef Name='Column6' LookupId='TRUE' /><Value Type='Text'>4387</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column7' LookupId='TRUE' /><Value Type='Text'>4204</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column8' LookupId='TRUE' /><Value Type='Text'>36</Value></Eq>
    </And>
    <Eq><FieldRef Name='Column9' LookupId='TRUE' /><Value Type='Text'>213</Value></Eq>
    </And>
    <IsNull><FieldRef Name='Column10' /></IsNull>
    </And>
    </Where>
    </Query>
    I have added this into my ItemAdding Event Receiver as it will basically do a check for duplicate items based on the 10 columns. 
    If anyone can help guide me in this, it would be much appreciated. I have been using a CAML Query Builder to help.

    http://webcache.googleusercontent.com/search?q=cache:xji7jOxa5_EJ:aasai-sharepoint.blogspot.com/2013/02/caml-query-with-multiple-conditions.html+&cd=3&hl=en&ct=clnk&gl=in
    http://stackoverflow.com/questions/6203821/caml-query-with-nested-ands-and-ors-for-multiple-fields
    Since you are not allowed to put more than two conditions in one condition group (And | Or) you have to create an extra nested group (MSDN). The expression
    A AND B AND C looks like this:
    <And>
    A
    <And>
    B
    C
    </And>
    </And>
    Your SQL like sample translated to CAML (hopefully with matching XML tags ;) ):
    <Where>
    <And>
    <Or>
    <Eq>
    <FieldRef Name='FirstName' />
    <Value Type='Text'>John</Value>
    </Eq>
    <Or>
    <Eq>
    <FieldRef Name='LastName' />
    <Value Type='Text'>John</Value>
    </Eq>
    <Eq>
    <FieldRef Name='Profile' />
    <Value Type='Text'>John</Value>
    </Eq>
    </Or>
    </Or>
    <And>
    <Or>
    <Eq>
    <FieldRef Name='FirstName' />
    <Value Type='Text'>Doe</Value>
    </Eq>
    <Or>
    <Eq>
    <FieldRef Name='LastName' />
    <Value Type='Text'>Doe</Value>
    </Eq>
    <Eq>
    <FieldRef Name='Profile' />
    <Value Type='Text'>Doe</Value>
    </Eq>
    </Or>
    If this helped you resolve your issue, please mark it Answered

  • HT201365 hello sir i purchase second hand iphone4s now my iphone ask for activation with id and password i contact with previous owner and use that id and password but that also not work what i do ola help me

    hello sir i purchase second hand iphone4s now my iphone ask for activation with id and password i contact with previous owner and use that id and password but that also not work what i do ola help me i try all other method restore ' upgrade etc but none work plz say what i do if u find some solution tham msg me on [email protected]

    First, we're not Apple here (Apple does not participate in this forum).  We're only users like you.
    The previous owner has not given you the correct ID and password for you to use.
    If the iphone has iOS version 7, then read through the following...
    http://support.apple.com/kb/HT5818

  • Need complex query  with joins and AGGREGATE  functions.

    Hello Everyone ;
    Good Morning to all ;
    I have 3 tables with 2 lakhs record. I need to check query performance.. How CBO rewrites my query in materialized view ?
    I want to make complex join with AGGREGATE FUNCTION.
    my table details
    SQL> select from tab;*
    TNAME TABTYPE CLUSTERID
    DEPT TABLE
    PAYROLL TABLE
    EMP TABLE
    SQL> desc emp
    Name
    EID
    ENAME
    EDOB
    EGENDER
    EQUAL
    EGRADUATION
    EDESIGNATION
    ELEVEL
    EDOMAIN_ID
    EMOB_NO
    SQL> desc dept
    Name
    EID
    DNAME
    DMANAGER
    DCONTACT_NO
    DPROJ_NAME
    SQL> desc payroll
    Name
    EID
    PF_NO
    SAL_ACC_NO
    SALARY
    BONUS
    I want to make  complex query  with joins and AGGREGATE  functions.
    Dept names are : IT , ITES , Accounts , Mgmt , Hr
    GRADUATIONS are : Engineering , Arts , Accounts , business_applications
    I want to select records who are working in IT and ITES and graduation should be "Engineering"
    salary > 20000 and < = 22800 and bonus > 1000 and <= 1999 with count for males and females Separately ;
    Please help me to make a such complex query with joins ..
    Thanks in advance ..
    Edited by: 969352 on May 25, 2013 11:34 AM

    969352 wrote:
    why do you avoid providing requested & NEEDED details?I do NOT understand what do you expect ?
    My Goal is :
    1. When executing my own query i need to check expalin plan.please proceed to do so
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9010.htm#SQLRF01601
    2. IF i enable query rewrite option .. i want to check explain plan ( how optimizer rewrites my query ) ? please proceed to do so
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/ex_plan.htm#PFGRF009
    3. My only aim is QUERY PERFORMANCE with QUERY REWRITE clause in materialized view.It is an admirable goal.
    Best Wishes on your quest for performance improvements.

  • Sql query with conditions and calculations???

    Hi,
    how I can build a query with conditions and calculations?
    E.g. I've got this table
    Start          | End     |     Working Place     |     Mandatory
    01-JAN-13 | 11-JAN-13 |     Office           |          1
    14-JAN-13 | 25-JAN-13 |     Home Office      |     0
    04-MRZ-13| 15-MRZ-13 |     Office           |          0
    11-FEB-13 | 22-FEB-13 |     Office           |          1
    Now if column working place=Office and column mandatory=0
    the new column "price" has to calculate: (End-Start)* $25.00
    and if working place=Office and column mandatory=1
    the "price" column has to calculate: (End-Start)* $20.60
    else $0.00
    I tried it with the case statement but I didn't know how
    to calculate my values and display it to the virtual column "price".
    Something like
    case
    when Working_Place = 'Office' and Mandatory=1
         then ...
    else '0.00'
    end as PRICE
    Or is it not possible?
    Edited by: DB2000 on 12.03.2013 05:09

    Use CASE:
    select  start_dt,
            end_dt,
            working_place,
            mandatory,
            case
              when working_place = 'Office' and mandatory = 0 then (end_dt - start_dt) * 25
              when working_place = 'Office' and mandatory = 1 then (end_dt - start_dt) * 20.60
              else 0
            end price
      from  tbl
    START_DT  END_DT    WORKING_PLA  MANDATORY      PRICE
    01-JAN-13 11-JAN-13 Office               1        206
    14-JAN-13 25-JAN-13 Home Office          0          0
    04-MAR-13 15-MAR-13 Office               0        275
    11-FEB-13 22-FEB-13 Office               1      226.6
    SQL> SY.

  • TS1717 Having trouble running iTunes version 11.0.2 on a Dell Laptop running Windows 7 Professional Service Pack 1.  Keep getting an error message "the software required for communicating with iPods and mobile phones was not installed correctly..." reinst

    Having trouble when I launch iTunes (version 11.0.2) on my Dell Laptop running Windows 7 Professional (service pack 1).  I get an error message indicating software required to communicate with iPod and mobile phones was not installed correctly.  Do you want iTunes to try to repair this for you?  I normally respond with OK and it immediately tells me "could not be repaired.  Please reinstall iTunes..."  I have done this a number of times to no avail.

    I also notice Quicktime is not getting installed at all.
    That one is normal nowadays (ever since the iTunes versions 10.5.x).
    The software required for communicating with iPods and mobile phones was not installed correctly. Do you want iTunes to try to repair this for you?
    Let's try a standalone Apple Mobile Device Support install. It still might not install, but fingers crossed any error messages will give us a better idea of the underlying cause of why it's not installing under normal conditions.
    Download and save a copy of the iTunesSetup.exe (or iTunes64setup.exe) installer file to your hard drive:
    http://www.apple.com/itunes/download/
    Download and install the free trial version of WinRAR:
    http://www.rarlab.com/
    Right-click the iTunesSetup.exe (or iTunes64setup.exe), and select "Extract to iTunesSetup" (or "Extract to iTunes64Setup"). WinRAR will expand the contents of the file into a folder called "iTunesSetup" (or "iTunes64Setup").
    Go into the folder and doubleclick the AppleMobileDeviceSupport.msi (or AppleMobileDeviceSupport64.msi) to do a standalone AMDS install.
    (If it offers you the choice to remove or repair, choose "Remove", and if the uninstall goes through successfully, see if you can reinstall by doubleclicking the AppleMobileDeviceSupport.msi again.)
    Does it install (or uninstall and then reinstall) properly for you?
    If instead you get an error message during the install (or uninstall), let us know what it says. (Precise text, please.)

  • Error message: "the software required for communicating with Ipods and mobile phones was not installed correctly....

    2 error messages when opening itunes: "The software required for communicating with Ipods and mobile phones was not installed correctly.  Do you want Itunes to repair this for you?"  When clicking yes another message indicates not able to remove services.  Another message is: "Service (ipod service) could not be installed.  Verify that you have sufficient privileges to install system sources."  I've uninstalled all Apple services (itunes, quicktime, apple software update, apple mobiles devices support, bonjour and apple application support and reinstalled itunes/quicktime - no change in error messages.  I cannot burn CDs using Itunes.  This all seemed to happen when I updated itunes to version 10.  I have a Windows 7 64-bit operating system on a Dell Inspiron Zino HD; the Itunes software is also 64 bit.

    See the second box of  Troubleshooting issues with iTunes for Windows updates.
    tt2

  • Hello sir i purchase second hand iphone4s now my iphone ask for activation with id and password i contact with previous owner and use that id and password but that also not work what i do ola help me i try all other method restore ' upgrade

    hello sir i purchase second hand iphone4s now my iphone ask for activation with id and password i contact with previous owner and use that id and password but that also not work what i do ola help me i try all other method restore ' upgrade etc but none work plz say what i do if u find some solution tham msg me on
    iPhone 4S

    oenkz33 wrote:
    this does not help at all for the second owner, after making the first owner id with careless, sorry for my english ...
    Careless? Possible, but unlikely. Most likely the phone was stolen from the first owner. It would be a VERY careless iPhone owner who did not erase their personal information from a phone before selling it, and to do that it is necessary to disable Activation Lock. In most places in the world knowingly using stolen property is a crime, so the fact that the phone doesn't work may be the least of one's risks.

  • When I click on itunes, it tells me that thesoftware required for communicating with ipods and mobil phones was not installed properly. I have not changed anything on my computer so I'm not sure what I should do? Help

    Help, When I click on itunes on my computer it tells me that the software required for communicating with ipods and mobil phone was not installed properly. I havent' changed anything. Does anyone know what I should do? Thanks

    See the second box of Troubleshooting issues with iTunes for Windows updates.
    tt2

  • I'm sorry, I have to convert the mov file. for use with fce and / or imovie11, better ProRes422 or intermediate codec?

    I'm sorry, I have to convert the mov file. for use with fce and / or imovie11, better ProRes422 or intermediate codec?

    FCE only used AIC for HD.
    Al

  • The software required for communicating with ipod and mobile phones was not installed correctly

    ok i've seen this in several threads and haven't found one with an anwser. the software required for communicating with ipod and mobile phones was not installed correctly. of course when you tell it to repair it does not. this has happened several times now and only cure i have found is uninstalling itunes and reinstalling. works for maybe a few weeks then does the same thing and i start all over again with uninstall and reinstall. i tunes version 10.4.1.10  64 bit running on windows 7 64 bit and trying to sync with Iphone 3gs - so anyone have a fix for this or am i stuck reinstalling itunes every few weeks???

    "The feature you are trying to use is on a network resource that is unavailable.  Click OK to try again, or enter an alternative path to a folder containing the installation package "iTunes64msi"
    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • I have a macbook pro with mountain lion and now so I can not synchronize my outlook calendar office 2011 for mac with ical and, therefore, with icloude. Can anyone help?

    I have a macbook pro with mountain lion and now so I can not synchronize my outlook calendar office 2011 for mac with ical and, therefore, with icloude. Can anyone help?

    http://support.apple.com/kb/HT5922
    If you want to mirror your desktop, see:
    http://support.apple.com/kb/HT5404
    Regards.

Maybe you are looking for

  • Image in template background do not appear in browser

    Hello all I run a site ( http://ntp.neuroscience.wisc.edu/ ) that uses templates for backgrounds/spry menus for its pages. We currently use three templates to display backgrounds across the site and up until a few days ago everything displayed fine,

  • Making a Windows 7 Toshiba laptop a dual boot system (w/ XP)

    I am looking to probably get a Toshiba laptop here in the next month. Most likely it will be one that will include WIndows 7. While I have another desktop with Windows 7 installed on it and like it for the most part, there are a few pieces of hardwar

  • What field on AR Credit note refers to Ref 2 on Account Balance

    Hi Experts, I'm trying to figure out what field on the AR Credit Memo pulls through to Ref 2 when viewing the Account Balance of a customer. I know that from the AR Invoice it is the "Customer Ref No." or OINV, NumAtCard but on the AR Credit Memo if

  • Oracle 11g installation issue while linking

    Dear All, I am installing Oracle11g as p, At the time while the installation is in progress faced errors related to links. we skipped those errors and completed the installation. But after that we are unable to login sqlplus with SIDadm error: /usr/l

  • Mail, Contacts and Calendars in Settings crashes; Contacts app is blank

    First issue - since upgrading my iPad2 to iOS5, the Mail, Contacts and Calendars in Settings crashes. All other options in Settings are fine - only issues is with Mail, Contacts and Calenders crashing. Second issue - I am using iCloud to sync contact