Hi John,
I am curious of your clause in the "where" criteria that says:

AND LAST_NAME || FIRST_NAME >= TRIM(:WS-BEGIN-KEY02)

The ">=" operator will include results that are not also exact matches, such
as in your hyphenated example: "Adam-salmi" returning "Adam"

If you want an exact match, replace the ">=" operator with "="

There are a number of ways to facilitate partial matches (such as using
"instr" or "like" operators) but it depends on the needs of your application
which uses this query.

Rich

rgpasc...@berkeley.edu
Rich Pascual
Database Programmer, IT Systems Management
Advancement Operations
U.C. Berkeley University Relations
Phone: (510) 643-7652


On Tue, Jul 27, 2010 at 10:46 AM, John H <ho...@chesterfield.gov> wrote:

> I am currently trying to write a select statement that will return
> name information. We have a situtation where we have last names with
> hypens in them and when the exact name is entered "Adam-salmi" it
> returns last names that are "Adam" also. I am new to Oracle and any
> help would be greatly appreciated. I will attach the sql statement.
>
>
> SELECT LAST_NAME,
>       FIRST_NAME,
>       MIDDLE_NAME,
>       SUFFIX,
>       TO_CHAR(BIRTH_DATE,'YYYY/MM/DD'),
>       SSN_OR_EIN,
>       WARRANT_DEPARTMENT,
>       WARRANT_KEY,
>       PERSON_SEX,
>       RACE_CODE,
>       LAST_NAME || FIRST_NAME
>    FROM PR00100T.WARRANT A,
>       PR00100T.MASTER_NAME B,
>       PR00100T.PERSON C
>    WHERE A.WANTED_PERSON_KEY = B.PERSON_KEY
>       AND A.WANTED_PERSON_KEY = C.PERSON_KEY
>       AND A.WANTED_NAME_KEY = B.NAME_KEY
>       AND A.WARR_STATUS_CODE = '01'
>    AND LAST_NAME || FIRST_NAME >= TRIM(:WS-BEGIN-KEY02)
>    ORDER BY B.LAST_NAME ASC,
>    B.FIRST_NAME ASC,
>    B.MIDDLE_NAME ASC,
>    A.WARRANT_KEY ASC;
>
> --
> You received this message because you are subscribed to the Google
> Groups "Oracle PL/SQL" group.
> To post to this group, send email to Oracle-PLSQL@googlegroups.com
> To unsubscribe from this group, send email to
> oracle-plsql-unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/Oracle-PLSQL?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

Reply via email to