Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

filter by range and specific values in Oracle query.

Posted on 2013-11-19
3
Medium Priority
?
301 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
3 Comments
 
LVL 78

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 1170 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
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…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

916 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