Reading a part of a string in SQL

August 4, 2009 at 21:03:32
Specs: Windows XP
I have a table with one column " otname "
table1.otname contains multiple rows of alpha-numeric string resembling the following data sample:

I want to read the fourth number in every string ( part of the string in bold ) and write a query in Oracle 10g
to read its description stored in another table. My dilemma is writing the first part of the query.i.e. choosing the fourth number of every string in a table

My second query will be something like this:

select description_text from table2 where sncode = 8281 -- fourth part of the data sample in every string

Many thanks.


See More: Reading a part of a string in SQL

Report •

August 11, 2009 at 00:19:59
Apologies it's not an exact answer: I can only speak from
MySQL experience but you may be able to find something
equivalent in oracle:

SUBSTRING_INDEX(SUBSTRING_INDEX(fieldname, '.', 4), '.', -

Alias this and you can use it in your "WHERE" clause

Report •
Related Solutions

Ask Question