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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle SQL

Status
Not open for further replies.

finny

Programmer
Nov 16, 2000
58
0
0
US
Hi All,
I have a web application that needs to pull back distinctive items by name. I have it set up so I can retrieve products that begin with A-Z, depending on the user selection. The problem I am having is how do I pull back products that begin with a number or asterik? I have it labeled as "OTHER" and would like to find out what the SQL statement would be for that criteria.

Thx in advance for any help...finny
 
What about this:

select name
from item
where substr (name,1,1) in
('0', '1', '2', '3', '4',
'5', '6', '7', '8', '*');
 
The ASCII function returns the numeric ASCII value of the left most letter in a string. You could use that value in your query. For the * it might be something like:

SELECT *
FROM MyTable
WHERE ASCII(MyField) = 42;

Looks like numbers are 48-57... Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
jee & thoey,

thx for the responses. I won't get a chance to try the suggestions before next week, but I'll let you know how it goes....finny

p.s. thoey, ever hear of Kings College? I knew a guy named Brian Hoey and thought he had a bro named Terry...
 
Sorry Finny, I have a Bro, but his name is Tom... Good luck with the Oracle... Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
Thx for input. I got it figured out my using UNIONS for each # and character needed.

finny.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top