Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search text

Status
Not open for further replies.

deddleston

Programmer
Oct 4, 2002
43
0
0
GB
i have a jsp webpage (search engine) when searching for text e.g;

CUST i need the results to include -

CUST
Cust
cust

do you know what i mean... any help much appreciated.

M$ arn't the only option!
 
Have you tried using a function like "upper" with "like"?

Example:
Code:
upper(TEXT_STRING) like '%CUST%'

Hope this helps!

Code:
select * from Life where Brain is not null
Consultant/Custom Forms & PL/SQL - Oracle 8.1.7 - Windows 2000
[sup]When posting code, please use TGML for readability. Thanks![sup]
 
well no - because then it will just convert whatever is searched for into uppercase, and only uppercase rresults will be shown. i need upper,lower and a mix (if they exist)

M$ arn't the only option!
 
Not exactly, see below:
Code:
SQL> create table test_it (text varchar2(30));

Table created.

SQL> insert into test_it values ('xxxcustxxx');

1 row created.

SQL> insert into test_it values ('xxxx zzzz Cust');

1 row created.

SQL> insert into test_it values ('CUST sssssssss');

1 row created.

SQL> select * from test_it
  2  where upper(text) like '%CUST%';

TEXT
------------------------------
xxxcustxxx
xxxx zzzz Cust
CUST sssssssss

SQL>
Is this not the result you wanted?

Code:
select * from Life where Brain is not null
Consultant/Custom Forms & PL/SQL - Oracle 8.1.7 - Windows 2000
[sup]When posting code, please use TGML for readability. Thanks![sup]
 

Or better yet make use of SOUNDEX function for fuzzy search.

Example
SELECT ename
FROM emp
WHERE SOUNDEX(ename)
= SOUNDEX('SMYTHE');

ENAME
----------
SMITH



Robbie

"The rule is, not to besiege walled cities if it can possibly be avoided" -- Art of War
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top