?
Solved

Is there some kind of pattern matching in oracle 9.2?

Posted on 2006-06-05
6
Medium Priority
?
772 Views
Last Modified: 2008-01-09
i want to do something simple, but using 9.2 (no regexp)

select from myTable
where
first character of myStringCol = 'a' and second character is a number
0
Comment
Question by:iamari
  • 3
  • 3
6 Comments
 
LVL 19

Expert Comment

by:actonwang
ID: 16835966
select *  from myTable
where ...
and chr(substr(myStringcol,2,1)) between 48 and  57
/
0
 
LVL 2

Author Comment

by:iamari
ID: 16835994
i mean, something other than:

select myCol from myTable
where
((substr(upper(myCol),1,1)='A') and
(substr(myCol,2,1)='0' or
substr(myCol,2,1)='1' or
substr(myCol,2,1)='2' or
substr(myCol,2,1)='3' or
substr(myCol,2,1)='4' or
substr(myCol,2,1)='5' or
substr(myCol,2,1)='6' or
substr(myCol,2,1)='7' or
substr(myCol,2,1)='8' or
substr(myCol,2,1)='9'
))
0
 
LVL 19

Expert Comment

by:actonwang
ID: 16836013
i just gave it to you :)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:iamari
ID: 16836026
actonwang, looks like the numbers are no good, i get:
Error: ORA-01722: invalid number
 (State:22005, Native Code: 6BA)
0
 
LVL 19

Accepted Solution

by:
actonwang earned 200 total points
ID: 16836049
sorry,

 select *  from myTable
where ...
and ascii(substr(myStringcol,2,1)) between 48 and  57
/
0
 
LVL 2

Author Comment

by:iamari
ID: 16836331
that works, thanks!
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
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.
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 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