Solved

filter by range and specific values in Oracle query.

Posted on 2013-11-19
3
297 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error in my cursor 5 63
Fill Date time Field 12 45
How to get the current date and Time upon oracle insert into a database table 9 86
Age Calculation from specific date 19 58
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
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 explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

734 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