Querying  Unicode (Arabic) Column

I have problem in querying on Arabic field which is stored in a column of type nVarchar2
The column is populated properly through c# program. The Arabic data is retrieved and presented properly.
The problem is when I Query the Column.
My query looks like
SELECT BookID , BookTitle FROM books WHERE author_ar like ‘%فيكتور%’
SELECT BookID , BookTitle FROM books WHERE author_ar like ‘xxx%’ (xxx being a Unicode input)
This query those not yield any results. However when I substitute the “like” operator with the “=” operator the search return the expected row.
N/B I am using Oracle 10 g release 2
     PARAMETER     VALUE
1     NLS_LANGUAGE     AMERICAN
2     NLS_TERRITORY     AMERICA
3     NLS_CURRENCY     $
4     NLS_ISO_CURRENCY     AMERICA
5     NLS_NUMERIC_CHARACTERS     .,
6     NLS_CHARACTERSET     WE8MSWIN1252
7     NLS_CALENDAR     GREGORIAN
8     NLS_DATE_FORMAT     DD-MON-RR
9     NLS_DATE_LANGUAGE     AMERICAN
10     NLS_SORT     BINARY
11     NLS_TIME_FORMAT     HH.MI.SSXFF AM
12     NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM
13     NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR
14     NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
15     NLS_DUAL_CURRENCY     $
16     NLS_COMP     BINARY
17     NLS_LENGTH_SEMANTICS     BYTE
18     NLS_NCHAR_CONV_EXCP     FALSE
19     NLS_NCHAR_CHARACTERSET     AL16UTF16
20     NLS_RDBMS_VERSION     10.2.0.1.0

Here is another scenario
I realized this
When i use PL/SQL Developer
The Unicode data is entered in the form inverted question marks ¿¿¿¿¿
actually it is representation i think when the Oracle interface cant find the character.
However when i run the query it return me the correct row.
So am bit sure i am missing Unicode or nvarchar2 representation Character set.
Hope this a valid assessments and will narrow down my problem :)
Regards Hratch

Similar Messages

  • Query on database column not working

    Hi
    i have a block which has around 40 columns.the block is based on a table which has more than 20000 records.When i try 2 make query on a Database column in Enter-Query mode its not working.It fetching all the records instead of the respective records
    THe block property is said to yes
    i have even set the query allowed,only propery of the column to YEs
    Can any one help me out of this??? do i need to set any other property???

    Thanks a lot for james and THomas and to all. The error is that i have missed the bracket for OR in my where condition ...Now im able to query all the columns.
    Thanks very much...
    I have one more doubt .i have a requirement in which when the user goes to the child block and makes a query is it possible to bring the associates parent records..wht code or trigger we need to rite ?
    normally we do for parent block when we query we populate the child. is this can be done?

  • Result of an SQL query as a Column name of another query

    Hi Friends,
    Can we use a result of a SQL Query as a column name of another table to retrieve data. If so please help me.
    For eg :
    I have a table where is store numbers;
    select col1 from table1 where col1='5';
    and i have another table where .. this value of col is a column name..
    select ( select col1 from table1 where col1='5') from table2;
    Thanks in advance.

    Hi,
    ORAFLEX wrote:
    Hi Friends,
    Can we use a result of a SQL Query as a column name of another table to retrieve data. If so please help me.
    For eg :
    I have a table where is store numbers;
    select col1 from table1 where col1='5';
    and i have another table where .. this value of col is a column name..
    select ( select col1 from table1 where col1='5') from table2;
    Thanks in advance.Do you really mean that?
    select col1 from table1 where col1='5';That query will always return either '5' or nothing. Whatever you're trying to accomplish with that, you can do with an EXISTS query.
    Perhaps you meant to reference two different columns in that query:
    select col1 from table1 where col2='5';In that case, sorry, no, you can't do that without resorting to dynamic SQL.
    If the same column is used throughout the query (but could change every time you run the query), then the dynamic SQL might be pretty easy. In SQL*Plus, for example, you could use substitution variables, defined in another query at run-time.
    If there are only a few possible values that the sub-query could possibly return, and you know what they all are, then you can fake a dynamic query like this:
    SELECT     CASE     ( SELECT  col1
                FROM       table1
                WHERE       col2     = '5'
              WHEN  'BONUS'     THEN  bonus
              WHEN  'COMM'     THEN  comm
              WHEN  'SAL'     THEN  sal
         END     AS col1
    FROM     table2
    ;Sorry to give such a vague answer, but it's the best I can do with the information I have.
    It would help if you posted a little sample data (CREATE TABLE and INSERT statments for both tables), and the results you want to get from that data. If you want to pass a parameter to the query, give the results you want for a couple of different parameters.

  • Creating Query with dynamic columns to show results

    Hi experts,
    I need to know how to create a query with dynamic columns. Meaning, I don't want to create a query with fixed columns representing the 12 periods of the fiscal year to show me actuals as the fiscal year proceeds.
    For example, if I am currently in the middle of period 3 (March) of a fiscal year, when I execute the query, I need it to automatically only show me the 'Actuals' for periods 1 and 2, without seeing the columns from periods 3 to 12 showing blank.
    Then when I am in the middle period 5 (May) the query should ONLY show me the columns for periods 1 to 4 'Actuals', no results should be shown for periods 5 to 12 yet, and I don't want to even see blank columns for period 6 to 12.
    How do I define my columns, to achieve this.
    Maximum points will be awarded.
    Thanks Everyone.

    Hi Josh,
    I'm having a little difficuluty understanding what should be included in my restricted key figures.
    The time characteristics that I have available to use are:
    0FISCPER3 (posting period)
    0FISCYEAR (fiscal year), currently using SAP EXIT to default current fiscal year.
    0FISCVARNT (fiscal year variant).
    In addition, I have the following characteristics available to be used in the columns:
    Value type (10)
    version (currently I'm using variable for it)
    Currency type (020)
    Currency (USD).
    Can you explain what my restricted key figure should be based on and how it should look.
    I tried to create a restircted key figure using 0AMOUNT, and 0FISCPER3. For 0FISCPER3  I created a range from 1 to previous period (using SAP EXIT that supplied previous period).I also had value type, version, currency type, and currency included in that restricted key figure.Then when I tried to drag 0FISCPER3 under the restricted key figure once again, it wouldn't let me, probably because I've already used 0FISCPER3 in the restricted key figure.
    Please let me know if my explanation is not clear.
    Your step by step help would be great.
    Thanks
    Edited by: Ehab Mansour on Sep 23, 2008 2:40 PM

  • About Query Data Source Columns property

    Hello everyone,
    I'm new to Oracle Forms version 10.1.0.2.
    When I create a data block based on a table using Data Block Wizard, the block's Query Data Source Columns property is automatically populated with column definition entries corresponding to the columns of the base table.
    I tried making changes to these entries, for example by changing the data types to wrong data types or even deleting them, and I found that those changes had no effect on the block at all. The form was still working as I wanted.
    Please explain what is exactly the role of the block's Query Data Source Columns property.
    Thank you very much.
    p.s: The F1 key help says "The Query Data Source Columns property is valid only when the Query Data Source Type property is set to Table, Sub-query, or Procedure". So, please explain in each context of Query Data Source Type.

    p.s: The F1 key help says "The Query Data Source Columns property is valid only when the Query Data Source Type property is set to Table, Sub-query, or Procedure". So, please explain in each context of Query Data Source Type.
    IMHO those properties are very self-explaining: It is the data source of the block, or in other terms: how it is populated.
    Table means the data block is based on a table and subsequently will be populated by
    select col1, col2, col3 from your_table
    With sub-query the block will be populated with your subquery; forms will issue
    select col1, col2, col3 from (
      -- this is your subquery
      select col1, col2, col3 from tab1, tab2 where [....]
    With Procedure in short you'd have a stored procedure which returns a ref cursor and the block will be populated by the ref cursor.
    As for your question about the name: this actually should matter; the default is NULL which means that there needs to be a column which has the exact name as the item so in the above sample with table the item associated with your_table.col1 should be named col1. If it isn't the property should be named like the column. If this property also doesn't reflect the name this shouldn't work IMO.
    cheers

  • ADF BC : "Attributes selected in query with no column type found! ..."

    hi
    Using JDeveloper 10.1.3.3.0, I have this "Selected in Query" attribute, "Never" updatable, in my Entity Object.
    The Entity Object is based on the SCOTT.EMP table and the attribute, called "BonusInfo", is defined using the expression " '[bonus info ' || (SAL * 2) || ']' ".
    see http://verveja.footsteps.be/~verveja/files/oracle/NoColumnTypeFoundApp-v0.01.zip
    While creating this Entity Object, I got a "Business Components" dialog that says:
    "Column type is not specified for this attribute. Specifying column-type and precision results in better query performance at runtime. Do you wish to set column type to VARCHAR2(255)?"
    I clicked "Yes".
    I also created two View Objects based on this Entity Object.
    In the "Create View Object" wizard "Step 4 of 7: Attribute Settings" I got a "Business Components" diaglog that says:
    "Attributes selected in query with no column type found! Specifying column-type and precision results in better query performance at runtime. Do you wish to set default column type for these attributes?"
    I clicked "Yes".
    Testing the query in "Step 5 of 7: SQL Statement" showed "Query is valid.".
    question:
    Why do I keep getting the message ...
    "Attributes selected in query with no column type found! Specifying column-type and precision results in better query performance at runtime. Do you wish to set default column type for these attributes?"
    ... in the View Object Editor if I click on different attributes?
    (I don't get such a message the first time I click on an attribute after opening the View Object Editor, but after that it keeps popping up each time I click on a different attribute, no matter what I answer "Yes", "No" or "Cancel".)
    many thanks
    Jan Vervecken

    Jan,
    BC needs the column type and precision so that we can allocate the correct JDBC buffer size; otherwise we would just allocate 2k per string.
    Blaise

  • Attributes selected in query with no column type found! (solved)

    Dear JHeadstart Team,
    In the view object Editor I have two entity based attributes attrib1 and attrib2
    both with type Number. Both have aliases with type number(9,0)
    If attrib1 is null I want to have the value of attrib2.
    In the expression box I put: nvl(attrib1,attrib2)
    When I press the ok button I get the next error message.
    "Attributes selected in query with no column type found!
    Specifying column-type and precision results in better query performance at runtime.
    Do you wish to set default column type for these attributes? "
    When I say ok I get the next message:
    "An error occurred. Unable to apply all the wizard changes.
    Column type cannot be changed for Entity based attribute.
    Exception: oracle.jbo.dt.objects.JboExeption."
    The details button serves no extra information.
    Since both the attributes have the same type I thought the nvl commando should work.
    But what does the "no column type found" sentence mean?
    regards,
    Marcel.
    Message was edited by:
    user571204

    Thanks Jan,
    You've put me on the right track.
    I found out that this is only possible in the entity object class.
    So I have to check my limited java skills.

  • Performance of update query for single column vs multiple column

    Hi All,
    I could not find any answer for this, does it ever matter in terms of performance updating single column versus multiple column in a single update query.
    For eg. table consisting of 15 columns, what would be the difference in performance when one column is update in the single query against another update query where 15 columns are updated.
    Please do keep in mind my table columns in actually could be around 150+.
    Thanks for any information provided.

    If updated columns aren´t on where clause , then the only impact of 15 columns will be a increase on redo generation, and a possible chainning row.
    So since the redo is one of the things that have a large impact, the answer is yes.
    The performance will be slower.
    Regards
    Helio Dias.
    http://heliodias.com
    OCE SQL, OCP 9i

  • How to query a CLOB column

    Hello All,
    I am trying to query a CLOB column with some text string. Can anyone tell me how to do this. Here is a simple example of my code and the error message I get....
    SQL> select title_column from atlas_table where clob_column like '%a%';
    select title_column from atlas_table where clob_column like '%e%'
    ERROR at line 1:
    ORA-00932: inconsistent datatypes
    Thanks,
    Danny

    Selecting a LOB from a table actually returns the LOB's locator and not the entire LOB value..
    and you should have a frontend to retrieve the clob or blob..
    if u have you can view/update/..do DML operations on the column
    null

  • Query rows to column

    dear Friends,
    i need query row to column
    example
    1 a data1 data2 data3
    2 b data1 data2 data3
    output format
    1 2 a
    data1 data2 data3

    Please consider the following when you post a question.
    1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
    You can use the following query and do a copy past of the output.
    select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
    that are asked the answer is already there.
    3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
    I have the following table called sales
    with sales
    as
          select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
          union all
          select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
    select *
      from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
    For example in the above sales table, I want to know the total quantity and number of invoice for each product.
    The output should look like this
    Prod_id   sum_qty   count_inv
    1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
    6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
    Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
    use the {noformat}{noformat} tags.
    The usage of the tag is like this.
    <place your code here>\
    7. If you are posting a *Performance Related Question*. Please read
       {thread:id=501834} and {thread:id=863295}.
       Following those guide will be very helpful.
    8. Please keep in mind that this is a public forum. Here No question is URGENT.
       So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Cannot query conditionals on column in view

    We are upgrading our oracle database from 9i to 11g. The upgrade is complete but we are running into one issue regarding a view. We are able to query the view without any problems, but when querying a specific column for a specific value, we are not getting a results back although we are able to when performing the same query on the 9i database. The view that is not working is:
    Select count(*) from v_test where statuscode like '%active%';
    The view has been dropped and recreated. If I do select * from v_test it works fine.
    Any help/suggestion is appreciated.

    CREATE OR REPLACE FORCE VIEW "JIFFY"."V_TEST" ("V_PROJECTID", "JIFFY", "TFIMS", "CSSR", "CFSR", "DD254", "DTICEXEMPT", "STATUSCODE", "LASTNONZEROMONTH", "BURNRATE", "LASTLMRDATE", "LASTLMRID", "TECHSTATUSDOCDATE", "TECHSTATUSDOCID", "REPORTFREQ", "FIRSTTECHRPTDUEDATE", "FACEVALUE", "RECEIVED", "TOTOBLIGATED", "CFYOBLIGATED", "TOTACCRUED", "FUNDSEXHAUSTIONDATE", "CONTTECHPOCID", "CONTTECHPOCNAME", "GOVTTECHPOCID", "GOVTTECHPOCNAME", "CONTRACTTYPE") AS
    SELECT      r."V_PROJECTID",r."JIFFY",r."TFIMS",r."CSSR",r."CFSR",r."DD254",r."DTICEXEMPT",
              s.statuscode,
              projectinfo.getLastNonZeroMonth(r.v_projectid) lastNonZeroMonth,
              projectinfo.getBurnRate(r.v_projectid) burnRate,
              projectinfo.getRecentLMRDate(r.v_projectid) lastLMRdate,
              projectinfo.getRecentLMRID(r.v_projectid) lastlmrid,
              projectinfo.getDCFTechStatusDocDate(r.v_projectid) techStatusDocDate,
              projectinfo.getDCFTechStatusDocID(r.v_projectid) techStatusDocID,
              projectinfo.getDueDateFreqRpt(r.v_projectid) reportFreq,
              projectinfo.getFirstTechRptDueDate(r.v_projectid) FirstTechRptDueDate,
              projectinfo.getFaceValue(r.v_projectid) FaceValue,
              projectinfo.getActualAllocationTot(r.v_projectid) received,
              projectinfo.getTotObligated(r.v_projectid) TotObligated,
              projectinfo.getCFYObligated(r.v_projectid) CFYObligated,
              projectinfo.getTotAccrued(r.v_projectid) TotAccrued,
              projectinfo.getFundsExhaustionDate(r.v_projectid) FundsExhaustionDate,
              projectinfo.getContTechPocId(r.v_projectid) ContTechPocId,
              SUBSTR(projectinfo.getContTechPocName (projectinfo.getContTechPocId(r.v_projectid)),1,50) ContTechPocName,
              projectinfo.getGovtTechPocId(r.v_projectid) GovtTechPocId,
              SUBSTR(projectinfo.getGovtTechPocName (projectinfo.getGovtTechPocId(r.v_projectid)),1,50) GovtTechPocName,
              SUBSTR(projectinfo.getContractType(r.v_projectid),1,50) ContractType
    FROM     v_projectspecialreqs r, v_projectstatus s
    WHERE     r.v_projectid = s.projectid (+);
    Since this view is a join of two other views, I thought I would provide the source for them as well...
    CREATE OR REPLACE FORCE VIEW "JIFFY"."V_PROJECTSPECIALREQS" ("V_PROJECTID", "JIFFY", "TFIMS", "CSSR", "CFSR", "DD254", "DTICEXEMPT") AS
    SELECT p.projectid v_projectid,
    DECODE(a.jiffy,'JIFFY','Y','N') jiffy,
    DECODE(b.tfims,'TFIMS','Y','N') tfims,
    DECODE(c.cssr, 'CSSR','Y','N') cssr,
    DECODE(d.cfsr, 'CFSR','Y','N') cfsr,
    DECODE(e.dd254,'DD254','Y','N') dd254,
    DECODE(f.dticx,'DTICX','Y','N') dticexempt
    FROM Project p,
    (SELECT tp.projectid, t.taxcode jiffy
    FROM tax_projects tp, taxonomy t
    WHERE tp.taxid = t.taxid
    AND t.taxcode in ('JIFFY')
    ) a,
    (SELECT tp.projectid, t.taxcode tfims
    FROM tax_projects tp, taxonomy t
    WHERE tp.taxid = t.taxid
    AND t.taxcode in ('TFIMS')
    ) b,
    (SELECT tp.projectid, t.taxcode cssr
    FROM tax_projects tp, taxonomy t
    WHERE tp.taxid = t.taxid
    AND t.taxcode in ('CSSR')
    ) c,
    (SELECT tp.projectid, t.taxcode cfsr
    FROM tax_projects tp, taxonomy t
    WHERE tp.taxid = t.taxid
    AND t.taxcode in ('CFSR')
    ) d,
    (SELECT tp.projectid, t.taxcode dd254
    FROM tax_projects tp, taxonomy t
    WHERE tp.taxid = t.taxid
    AND t.taxcode in ('DD254')
    ) e,
    (SELECT tp.projectid, t.taxcode dticx
    FROM tax_projects tp, taxonomy t
    WHERE tp.taxid = t.taxid
    AND t.taxcode in ('DTICX')
    ) f
    WHERE p.projectid = a.projectid (+)
    AND p.projectid = b.projectid (+)
    AND p.projectid = c.projectid (+)
    AND p.projectid = d.projectid (+)
    AND p.projectid = e.projectid (+)
    AND p.projectid = f.projectid (+);
    CREATE OR REPLACE FORCE VIEW "JIFFY"."V_PROJECTSTATUS" ("PROJECTID", "STATUSCODE") AS
    SELECT tp.projectid projectid, t.taxcode
    statuscode
    FROM tax_projects tp, taxonomy t
    WHERE tp.taxid = t.taxid
    AND t.taxcode in ('ACTV', 'INACTV', 'CMPLT', 'CNCL');

  • Full text query across multiple columns

    In the SQL Server, when you do the full text query, you can specify multiple columns, e.g.
    FREETEXT ( { column_name | [b](column_list) | * } , 'freetext_string' [ , LANGUAGE language_term ] )
    CONTAINS ( { column_name | [b](column_list) | * } , '< contains_search_condition>' [ , LANGUAGE language_term ])
    Where,
    column_list Indicates that several columns, separated by a comma, can be specified...
    * Specifies that all columns in the table registered for full-text searching should be used to search for the given contains search condition. The columns in the CONTAINS clause must come from a single table...
    That makes full text query cross multiple columns very convenient. Are there any mechnisms in Oracle to do the same thing?
    Thanks in advance.

    Thanks for your reply.
    I knew that you could build full text index for the multiple columns using Oracle Text. But that does not solve my problem, which is how to build the query to search multiple columns at once. Say, I have columns firstname, lastname, address, and email in the table customers. I want to get the results that ANY column contains 'bob'. In SQL Server, I can do
    select * from customers where contains(*, 'bob')
    that is. But for Oracle, I have to do
    select * from customers where contains('firstname', 'bob') or contains('lastname', 'bob') or contains('address', 'bob') or contains('email', 'bob')
    Can you imagine if I have many columns in many tables and I have to do the query against all columns in all tables? I have to dynamically get all the columns and then build the query string.
    So, any better solutions?

  • How to configure solaris 7 to support unicode(Arabic)

    hi all,
    I have a problem in configuring solaris 7 to support Unicode(Arabic). Anyone know about this pls give me the guidelines to configure the environment variables, etc.,
    -Thameem.

    hi all,
    I found out the solution. Its working properly.
    -Thameem

  • Unicode : cannot filter query with NVARCHAR2 column

    Hi,
    this is not a POL/SQL-Developer specific problem - but help would be appreciated.
    Configuration Server :
    NLS_CHARACTERSET WE8ISO8859P15
    NLS_NCHAR_CHARACTERSET AL16UTF16
    Client :
    NLS_LANG GERMAN_GERMANY.WE8MSWIN1252
    Column definition :
    LEGALNAME NVARCHAR2 (255);
    If i store for example a kyrillic name with the application i am able to finde the row searching the for the most current modification date and with correct kyrillic coded name.
    but if i want to query by the Legalname - a)/b) does not work;
    A) SELECT * FROM COMPANY WHERE LEGALNAME LIKE 'View, системой%';
    B) SELECT * FROM COMPANY WHERE LEGALNAME LIKE N'View, системой%';
    Do you have some hints???
    kind regards
    Karl
    Edited by: [email protected] on 10-Mar-2009 07:05
    Edited by: [email protected] on 10-Mar-2009 07:10
    Edited by: Spinthma on 12-Mar-2009 03:23

    Hello Sergiusz,
    first thanks a lot for your taking time!!
    it did not work for PL/SQL-Developer (applied both registry - all oracle homes and in environment)
    but it worked for Oracle SQL-Developer according your last posting;
    [m-1951097]
    bq. {color:#808080}By default, SQL Developer uses the JDBC Thin driver. This driver does not recognize the ORA_NCHAR_LITERAL_REPLACE, but the oracle.jdbc.convertNcharLiterals property. Try to add this property to the &lt;SQLDEV_HOME&gt;\sqldeveloper\bin\sqldeveloper.conf file: \\ AddVMOption -Doracle.jdbc.convertNcharLiterals=true \\ Let us know if it helps. I have no time to test myself. \\ {color} \\ {color:#808080} \\ Sergiusz{color}
    {color:#000000}Karl{color}
    bq. {color:#808080} \\ {color}

  • Query help: query to return column that represents multiple rows

    I have a table with a name and location column. The same name can occur multiple times with any arbitrary location, i.e. duplicates are allowed.
    I need a query to find all names that occur in both of two separate locations.
    For example,
    bob usa
    bob mexico
    dot mexico
    dot europe
    hal usa
    hal europe
    sal usa
    sal mexico
    The query in question, if given the locations usa and mexico, would return bob and sal.
    Thanks for any help or advice,
    -=beeky

    How about this?
    SELECT  NAME
    FROM    <LOCATIONS_TABLE>
    WHERE   LOCATION IN ('usa','mexico')
    GROUP BY NAME
    HAVING COUNT(DISTINCT LOCATION) >= 2Results:
    SQL> WITH person_locations AS
      2  (
      3          SELECT 'bob' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      4          SELECT 'bob' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      5          SELECT 'dot' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      6          SELECT 'dot' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      7          SELECT 'hal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      8          SELECT 'hal' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      9          SELECT 'sal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
    10          SELECT 'sal' AS NAME, 'Mexico' AS LOCATION FROM DUAL
    11  )
    12  SELECT  NAME
    13  FROM    person_locations
    14  WHERE   LOCATION IN ('USA','Mexico')
    15  GROUP BY NAME
    16  HAVING COUNT(DISTINCT LOCATION) >= 2
    17  /
    NAM
    bob
    salHTH!
    Edited by: Centinul on Oct 15, 2009 2:25 PM
    Added sample results.

Maybe you are looking for