• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

filter by range and specific values in Oracle query.

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
Butterfly2
Asked:
Butterfly2
1 Solution
 
slightwv (䄆 Netminder) Commented:
Is that sample 10 rows from proc_code or one row?

What is your search criteria?

Can you provide some sample results?
0
 
DavidSenior Oracle Database AdministratorCommented:
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
 
Butterfly2Author Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now