Solved

filter by range and specific values in Oracle query.

Posted on 2013-11-19
3
298 Views
Last Modified: 2013-11-19
Good Morninging experts,

I am writing a query but I have to filter on a specific field that contains exact values as well as ranges.  The field is a varchar but the values look like numbers.

for example I need to filter on field called proc_code with the following values.
17.31 thru 17.36,
17.39,
45.03,
45.26,
45.41,
45.71-45.81,
45.92 -45.95,
46.12,
46.18,
46.75

Any assitance would be greatly appreciated.
0
Comment
Question by:Butterfly2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39659766
Is that sample 10 rows from proc_code or one row?

What is your search criteria?

Can you provide some sample results?
0
 
LVL 23

Accepted Solution

by:
David earned 390 total points
ID: 39660008
At face value,
... WHERE proc_code IN ("17.39","45.03",(fill here)"46.75")
OR REGEXP_LIKE (TO_NUMBER(proc_code), ^(17.3[1-6])$))
OR REGEXP_LIKE (TO_NUMBER(proc_code), ^(45.[7-8]1)$))
OR REGEXP_LIKE (TO_NUMBER(proc_code), ^(45.9[2-5])$))
0
 

Author Comment

by:Butterfly2
ID: 39660082
ok I was doing and instead of or, I feel so stupid,  Anyway dvz you get the points b/c I saw the or in example.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to recover a database from a user managed backup
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question